hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.71k stars 1.17k forks source link

Always the same error: cannot import name 'RGBMatrixOptions' from 'rgbmatrix' #1076

Open petike779 opened 4 years ago

petike779 commented 4 years ago

Hi all Using 2x 16x32 panels in parallel connection as 32x32, Pi4B+ 4G Using all the instructions , successfully working examples on folders:

-examples-api-use folder -utils folder On python folder I have a problem... I am fighting with this error like most of beginners I suppose: $ sudo ./simple-square.py Traceback (most recent call last): File "./simple-square.py", line 2, in from samplebase import SampleBase File "/home/pi/display16x32/rpi-rgb-led-matrix/bindings/python/samples/samplebase.py", line 7, in from rgbmatrix import RGBMatrix, RGBMatrixOptions ImportError: cannot import name 'RGBMatrixOptions' from 'rgbmatrix' (/usr/local/lib/python3.7/dist-packages/rgbmatrix/init.py)**

Steps done as in readme instructions:

$ sudo apt-get update && sudo apt-get install python3-dev python3-pillow -y Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Hit:2 http://archive.raspberrypi.org/debian buster InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'python3-pil' instead of 'python3-pillow' python3-dev is already the newest version (3.7.3-1). python3-pil is already the newest version (5.4.1-2+deb10u1). 0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

$ make build-python PYTHON=$(which python3) make -C ../../lib make[1]: Entering directory '/home/pi/display16x32/rpi-rgb-led-matrix/lib' make[1]: Leaving directory '/home/pi/display16x32/rpi-rgb-led-matrix/lib' /usr/bin/python3 setup.py build --build-lib . running build running build_py running build_ext

$ sudo make install-python PYTHON=$(which python3) /usr/bin/python3 setup.py install running install running build running build_py running build_ext running install_lib running install_egg_info Removing /usr/local/lib/python3.7/dist-packages/rgbmatrix-0.0.1.egg-info Writing /usr/local/lib/python3.7/dist-packages/rgbmatrix-0.0.1.egg-info

And here I cannot do nothing... Tried also a clean reinstall with downloading again with git, doing all the steps again. I tried also with python 2.7 usage, the same error. Reading other comments I realize that I am missing simple step... Thanks in advance Peter

petike779 commented 4 years ago

Hi everyone I found my problem. Maybe solution will help others also fighting with this issue. On the file /urs/local/lib/python3.7/dist-packages/rgbmatrix/_init.py is missing one argument:

-- coding: utf-8 --

from future import absolute_import version = "0.0.1" author = "Christoph Friedrich christoph.friedrich@vonaffenfels.de" from .core import RGBMatrix, FrameCanvas

Because this file is write protected, first I had to change it to writable: sudo chmod 666 _init.py With nano adding the missing argument:

-- coding: utf-8 --

from future import absolute_import version = "0.0.1" author = "Christoph Friedrich christoph.friedrich@vonaffenfels.de" from .core import RGBMatrix, FrameCanvas, RGBMatrixOptions

Save it. Don't forget to change back permissions: sudo chmod 644 _init.py

Now all python scripts from samples folders are working. I don't know how disapeared this argument. Cheers Peter