jgarff / rpi_ws281x

Userspace Raspberry Pi PWM library for WS281X LEDs
BSD 2-Clause "Simplified" License
1.76k stars 616 forks source link

Cannot Build setup.py on RP4 #472

Closed robofred closed 2 years ago

robofred commented 2 years ago

Newbie here - was able to clone/build/install and run strandtest.py on RP4-first but when I tried running the exact same steps on my RP4-second, I get the following error output:

`Extracting in /tmp/tmpygytrjlh Now working in /tmp/tmpygytrjlh/setuptools-5.7 Building a Setuptools egg in /home/pi/neopix/rpi_ws281x/python Traceback (most recent call last): File "setup.py", line 19, in exec(init_file.read(), command_ns) File "", line 11, in File "/tmp/tmpygytrjlh/setuptools-5.7/setuptools/init.py", line 12, in from setuptools.extension import Extension File "/tmp/tmpygytrjlh/setuptools-5.7/setuptools/extension.py", line 7, in from setuptools.dist import _get_unpatched File "/tmp/tmpygytrjlh/setuptools-5.7/setuptools/dist.py", line 18, in import pkg_resources File "/tmp/tmpygytrjlh/setuptools-5.7/pkg_resources.py", line 1520, in register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider) AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader' /home/pi/neopix/rpi_ws281x/python/setuptools-5.7-py3.7.egg Traceback (most recent call last): File "/home/pi/neopix/rpi_ws281x/python/ez_setup.py", line 142, in use_setuptools pkg_resources.require("setuptools>=" + version) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 900, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 786, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'setuptools>=5.7' distribution was not found and is required by the application

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "setup.py", line 4, in use_setuptools() File "/home/pi/neopix/rpi_ws281x/python/ez_setup.py", line 145, in use_setuptools return _do_download(version, download_base, to_dir, download_delay) File "/home/pi/neopix/rpi_ws281x/python/ez_setup.py", line 120, in _do_download _build_egg(egg, archive, to_dir) File "/home/pi/neopix/rpi_ws281x/python/ez_setup.py", line 69, in _build_egg raise IOError('Could not build the egg.') OSError: Could not build the egg. ` I'm very new to the Linux operating system. I do know there's very little difference between my dev platform (RP4-first) and my production (RP4-second) platform. Any ideas whats happening here?

Gadgetoid commented 2 years ago

The Python code here is deprecated:

sudo pip3 install rpi_ws281x

robofred commented 2 years ago

I tried to install rpi_ws281x but it turned out that my production machine did not have pip3 installed.

Once I installed pip3,

sudo apt-get install python3-pip

I was able to build setup.py correctly... and from there everything worked great.

Thanks a lot

/F

robofred commented 2 years ago

Perhaps this is the wrong place to have this discussion but any idea why vast majority of people can't get the Adafruit Blinka (CircuitPython Lib) installed on their machine? I noticed that was the last step in your implementation but if I've understood that correct, why the need for this library?

{{PS. let me know i'm happy to delete this comment if there's a better place to ask this question}}

Gadgetoid commented 2 years ago

The Blinka/CircuitPython lib is unrelated to rpi_ws281x- albeit we did once have a "neopixel" library as part of the Python distribution that we dropped at their request- they wanted to build cross-platform "neopixel" support, using rpi_ws281x but without the two packages conflicting.

There should be no need for it!