Page 1 of 2

ModuleNotFoundError: No module named 'pyb'

Posted: Tue Feb 11, 2020 2:19 pm
by spoetnic
Hello, I'm just new to micropython and I just managed to get python installed on microsoft code.
Now I've connected my pyboard 1.1 and try to run a default program.
The first error I hit is: ModuleNotFoundError: No module named 'pyb'

I hope someone can help solving this? Thanks.

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Tue Feb 11, 2020 5:45 pm
by dhylands
Which board are you using? The pyb module exists on the stm32 port, and doesn't exist on the ESP32 and ESP8266 ports.

The general preference is to use the machine module where possible.

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Feb 13, 2020 8:45 am
by spoetnic
Hi, I'm using the pyboard 1.1. So this is with the STM32405RG. I'm trying to upload an code to the board from VSCODE. The board is connected, but when trying to RUN it says:

PS C:\Users\Marc Frim> & "C:/Users/Marc Frim/AppData/Local/Programs/Python/Python38-32/python.exe" "c:/Users/Marc Frim/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.7/microExamples/examples/03.board/5.pyboard/blink.py"
Traceback (most recent call last):
File "c:/Users/Marc Frim/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.7/microExamples/examples/03.board/5.pyboard/blink.py", line 2, in <module>
import pyb
ModuleNotFoundError: No module named 'pyb'
PS C:\Users\Marc Frim>

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Feb 13, 2020 12:23 pm
by jimmo
It looks like it's trying to run in regular Python (i.e. CPython) rather than on the pyboard.

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Tue Feb 18, 2020 11:34 am
by spoetnic
Indeed I did install python, RT-Thread MicroPython and Pymakr into VS code. Still I'm getting this error: ModuleNotFoundError: No module named 'pyb' when pressing RUN.

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Jul 30, 2020 7:00 am
by fillofonta
i'm having a similar problem with pycharm, the error is the following :
DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
ERROR: Could not find a version that satisfies the requirement pyb (from versions: none)
ERROR: No matching distribution found for pyb
I am able to install other libraries of micropython

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Jul 30, 2020 9:20 am
by jimmo
You don't need to pip install the pyb module, it's included in the firmware.

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Jul 30, 2020 9:22 am
by fillofonta
how do i use it then? when i write it i get Unresolved reference 'pyb'

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Jul 30, 2020 9:40 am
by Roberthh
The pyb module only exists on Pyboard hardware. Which board are you using?

Re: ModuleNotFoundError: No module named 'pyb'

Posted: Thu Jul 30, 2020 9:56 am
by fillofonta
i am using a nucleo-f767zi, but shouldn't be able to mimport it anyway and not be able af use it??