rm-hull/luma.led_matrix

No module named luma.led.matrix.device

Closed this issue · 11 comments

I'll start by apologising, I'm new to python and raspberry pi. I have very limited programming experience from when I used to mess around with some things a few years ago but mostly forgotten.

I'm trying to program an array of 4 8x8 LED matrices to display crypto currency prices. Right now Im stuck on the basics

I've cloned the repository, and when I try to run
$ python examples/matrix_demo.py
i get hit with
Traceback (most recent call last):
File "examples/matrix_demo.py", line 10, in <module>
from luma.led_matrix.device import max7219
ImportError: No module named luma.led_matrix.device

My pip version is 9.0.1 and python version 2.7

I've been trying to figure out why its happening but I really dont know
Please help :(

I did, and I just read through it again to double check but everything seems fine up until I try to test the example

$ lsmod | grep -i spi
spidev 7373 0
spi_bcm2835 7596 0

$ ls -l /dev/spi*
crw-rw---- 1 root spi 153, 0 Apr 7 18:41 /dev/spidev0.0
crw-rw---- 1 root spi 153, 1 Apr 7 18:41 /dev/spidev0.1

@boringtrousers if you used sudo to install the packages you also need to sudo to run the demo, e.g. sudo python examples/matrix_demo.py.

@thijstriemstra I've tried that too but it still doesnt work :(

It sounds like it didn't install properly. Can you check by running:

pip list | grep luma

You should see entries for luma.core and luma.led_matrix at least. If not, try reinstalling again with:

sudo -H pip install -U luma.led_matrix

Could you paste the output that that command produces?

@rm-hull
I seem to have both those entries showing up, here

$ pip list | grep luma
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
luma.core (1.7.2)
luma.led-matrix (1.0.8)

I've just noticed, the second one has a hythen instead of an underscore.. would that be a problem? I dont know how to change that
Thanks for the help, by the way

  • What version of python are you using (use python -V) ?

  • What is the output of pip show luma.led_matrix?

I think pip will treat hyphen and underscore interchangeably, BTW.

Python 2.7.13

$ pip show luma.led_matrix
Name: luma.led-matrix
Version: 1.0.8
Summary: A library to drive a MAX7219 LED serializer (using SPI) and WS2812 NeoPixels (using DMA)
Home-page: https://github.com/rm-hull/luma.led_matrix
Author: Richard Hull
Author-email: richard.hull@destructuring-bind.org
License: MIT
Location: /usr/local/lib/python2.7/dist-packages/luma.led_matrix-1.0.8-py2.7.egg
Requires: luma.core, rpi-ws281x, ws2812

@boringtrousers - see comment rm-hull/luma.examples#24 (comment) - maybe a force reinstall will work for you?

Obviously the package would be different:

sudo -H pip install --upgrade --force-reinstall --ignore-installed luma.led_matrix

Thank you, I saw your comment but I haven't been able to try this for the past couple of weeks, as I have been away.
Just tried force reinstalling and it fixed the problem.
Thanks a lot

@boringtrousers - see comment rm-hull/luma.examples#24 (comment) - maybe a force reinstall will work for you?

Obviously the package would be different:

sudo -H pip install --upgrade --force-reinstall --ignore-installed luma.led_matrix

Thanks, this solved my issue too.