ImportError: no module named 'smbus2'

3.1k Views Asked by At

I'm using Pymakr on VScode to program a Pycom L01, which is connected to several sensors. i'm trying to use smbus2 library, but i can't import it.
I created a python virtual enviroment and installed it using 'pip install smbus2', but when i try to upload the sketch, the output is:

    Traceback (most recent call last):
    File "main.py", line 4, in <module>
    File "/flash/lib/bmp280.py", line 3, in <module>
    ImportError: no module named 'smbus2' 
    Pycom MicroPython 1.18.2.r1 [v1.8.6-849-e0fb68e] on 2018-12-08; LoPy with ESP32
    Type "help()" for more information.

Someone who can help me?

2

There are 2 best solutions below

0
On BEST ANSWER

Solved, that was a noob mistake. The project files were outside the virtual enviroment directory. oof.

0
On

May be You have not installed smbus2 module. Please install it and import it in your program.