luma.examples: Luma.OLED RPI3 ImportError: No module named luma....

Sorry to be a pain but having spent an hour here and an hour there on this and followed through all the other people having similar issues, I still cannot get any of the examples to run on my RPI3 running the latest Raspian.

I’ve remove, installed, pulled the latest examples down and have…

luma.core (0.5.4)
luma.oled (2.2.5)

…both installed. I’m also using pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

running python examples/demo.py gives:

Traceback (most recent call last):
  File "examples/demo.py", line 17, in <module>
    from luma.core.render import canvas
ImportError: No module named luma.core.render

and as another example, running python examples/welcome.py gives:

  File "examples/welcome.py", line 14, in <module>
    from luma.core.virtual import viewport, snapshot, range_overlap
ImportError: No module named luma.core.virtual

Any and all help would be much appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (5 by maintainers)

Most upvoted comments

@nishabe:

The pip installed on Jessie was quite old AFAICR, so we needed to bootstrap the latest pip and setuptools from pypi. Maybe that advice no longer applies on the latest Rasbian image.

You should just install the latest luma.oled from pypi using sudo -H pip install --upgrade --force-reinstall --ignore-installed luma.oled and if you could post the output of that command here

thanks again πŸ˜ƒ @thijstriemstra

it’s because you installed luma using sudo pip3. Take a look at virtualenvwrapper library to create a virtual environment where you can install and use luma without sudo.

yea, try that command with sudo

Thank you. It did fix it. πŸ’― Here is the output of the command:

pi@raspberrypi:~/luma.examples $ sudo -H pip install --upgrade --force-reinstall --ignore-installed luma.oled
Collecting luma.oled
  Downloading luma.oled-2.3.1-py2.py3-none-any.whl
Collecting luma.core>=1.1.1 (from luma.oled)
  Downloading luma.core-1.2.1-py2.py3-none-any.whl (51kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 61kB 1.0MB/s 
Collecting pillow>=4.0.0 (from luma.core>=1.1.1->luma.oled)
Collecting monotonic; python_version < "3.3" (from luma.core>=1.1.1->luma.oled)
  Downloading monotonic-1.4-py2.py3-none-any.whl
Collecting smbus2 (from luma.core>=1.1.1->luma.oled)
  Downloading smbus2-0.2.0.tar.gz
Collecting RPI.GPIO; platform_system == "Linux" (from luma.core>=1.1.1->luma.oled)
  Downloading RPi.GPIO-0.6.3.tar.gz
Collecting spidev; platform_system == "Linux" (from luma.core>=1.1.1->luma.oled)
  Downloading spidev-3.2.tar.gz
Collecting olefile (from pillow>=4.0.0->luma.core>=1.1.1->luma.oled)
Building wheels for collected packages: smbus2, RPI.GPIO, spidev
  Running setup.py bdist_wheel for smbus2 ... done
  Stored in directory: /root/.cache/pip/wheels/90/71/b4/9f90d8e2d0349ab55fef07169a81bd8f925965f16174e2f809
  Running setup.py bdist_wheel for RPI.GPIO ... done
  Stored in directory: /root/.cache/pip/wheels/ae/4d/3b/e924997dbf06810adf3b2e37f1d9627b2327eb9cbb285949c9
  Running setup.py bdist_wheel for spidev ... done
  Stored in directory: /root/.cache/pip/wheels/e4/9b/5f/cf0ec030fc958b72315a15412130e4e1dc6040cdb490aa21fb
Successfully built smbus2 RPI.GPIO spidev
Installing collected packages: olefile, pillow, monotonic, smbus2, RPI.GPIO, spidev, luma.core, luma.oled
Successfully installed RPI.GPIO-0.6.3 luma.core-1.2.1 luma.oled-2.3.1 monotonic-1.4 olefile-0.44 pillow-4.3.0 smbus2-0.2.0 spidev-3.2