rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
367 stars 140 forks source link

ModuleNotFoundError: No module named 'luma' - when using Python 3.9.6 #147

Closed Gun-neR closed 3 years ago

Gun-neR commented 3 years ago

Things worked fine after a clean install of RPi OS Buster, but after upgrading to Python 3.9.6 none of the examples will run.

pi@raspberrypi:~ $ python3 --version
Python 3.9.6
pi@raspberrypi:~ $ python3 /home/pi/luma.examples/examples/pi_logo.py -d ssd1331 -i spi --width 96
Traceback (most recent call last):
  File "/home/pi/luma.examples/examples/pi_logo.py", line 12, in <module>
    from demo_opts import get_device
  File "/home/pi/luma.examples/examples/demo_opts.py", line 8, in <module>
    from luma.core import cmdline, error
ModuleNotFoundError: No module named 'luma'
pi@raspberrypi:~ $
thijstriemstra commented 3 years ago

but after upgrading to Python 3.9.6

How did you upgrade? Try running

cd /path/to/luma.examples
/usr/local/bin/python3.9 -m pip install -e .

to install luma.examples again using python3.9

and

/usr/local/bin/python3.9 /home/pi/luma.examples/examples/pi_logo.py -d ssd1331 -i spi --width 96

to run the example.

Gun-neR commented 3 years ago

How did you upgrade?

https://raspberrytips.com/install-latest-python-raspberry-pi/

Try running

That just tosses out a whole list of errors... apparently something is now broken with my python versions, or at least the symbolic links, as I can't even start Thonny anymore.

However I was able to run the example by pointing directly to python3.7 (but not any other version variations) probably becasue that is what it was installed with in the first place. If I recall, I had to use pip3 in order to even install it (the examples).

Works fine --> python3.7 /home/pi/luma.examples/examples/pi_logo.py -d ssd1331 -i spi --width 96

So I think the issue is at my end, with a messed up python install or something with the links, and not your library.

Sorry for false alarm.