pimoroni / grow-python

Python libs for controlling the Grow HATs
MIT License
57 stars 43 forks source link

Install no longer compatible with Bullseye (or Bookworm!) #38

Open ahnlak opened 9 months ago

ahnlak commented 9 months ago

With the move to the "new" way of doing things, we've broken compatibility with Bullseye ("Raspberry OS Legacy");

At the same time, the venv stuff doesn't quite work under Bookworm, because the service created by the install has no understanding of venv; I would give you a patch for that, but I got stuck in a quagmire of things like numpy refusing to play ball and it all felt like a wider job than just Grow (I'm guessing other Pimoroni products take a service-based approach so perhaps the venv approach needs more looking at?)

oliverlucas85 commented 8 months ago

Any tips on getting grow working would be much appreciated. I just fired it up expecting it to work and sadly disappointed and it doesn't look like anyone from Pimoroni monitors these issues?

ahnlak commented 8 months ago

I've assembled a procedure to get up and running on Bullseye, which has been reported as successful by others:

I'm aware that there is a mammoth task to get things more Bookworm-friendly across their whole range, so I'm reluctant to start throwing PRs at them until there's a clearer path forward there.

oliverlucas85 commented 8 months ago

OMG - Thank you so much, looks to be powering up the display now and the systemd service is all working - Thank you so much for the assist!

Honestly not sure I would have got to a working solution without your help!

Gadgetoid commented 8 months ago

@ahnlak thanks for the sleuthing here- I've created a new branch: https://github.com/pimoroni/grow-python/tree/bullseye

And released a new version 0.0.3 that explicitly targets the dependency versions before my break-all-the-things updates.

Aaaand retargeted the "get" script to bull the bullseye branch.

(I do monitor these issues but currently everything is broken and cloning myself into an almighty Python army is still out of my grasp)

xoblite commented 8 months ago

After some ugly manual installation hackery with the public branch, I managed to run lcd-demo.py successfully, but the main attraction was still standing:

user@host:~/Pimoroni/growhat/examples $ python3 monitor.py Traceback (most recent call last): File "/home/pi/.local/lib/python3.11/site-packages/grow/moisture.py", line 41, in init GPIO.add_event_detect(self._gpio_pin, GPIO.RISING, callback=self._event_handler, bouncetime=1) RuntimeError: Failed to add edge detection

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/Pimoroni/growhat/examples/monitor.py", line 1158, in main() File "/home/pi/Pimoroni/growhat/examples/monitor.py", line 1042, in main Channel(2, 2, 2), ^^^^^^^^^^^^^^^^ File "/home/pi/Pimoroni/growhat/examples/monitor.py", line 647, in init self.sensor = Moisture(sensor_channel) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/pi/.local/lib/python3.11/site-packages/grow/moisture.py", line 44, in init raise RuntimeError("""Unable to set up edge detection on BCM8. RuntimeError: Unable to set up edge detection on BCM8.

Please ensure you add the following to /boot/config.txt and reboot:

dtoverlay=spi0-cs,cs0_pin=14 # Re-assign CS0 from BCM 8 so that Grow can use it

...however the config.txt lines are already in there. Unfortunately I don't know any Python, so can't help out with this one I'm afraid. Any easy fix to get around the above? Or is this already sorted out in the new 0.0.3 preview branch? (I don't have the Pi nearby currently so haven't been able to check it out yet)

ahnlak commented 8 months ago

You'd need to provide more information (at a bare minimum, the Pi version and OS version you're using, and potentially more details on the "ugly hackery" - although this really doesn't sound like it's related to this particular issue?

xoblite commented 8 months ago

Sorry, the title included "Bookworm" so I just assumed this issue was mainly intended to address the fact that the public v0.0.1 is seriously broken on what is nowadays the mainstream choice for most people; I wasn't aware that it was also broken on Bullseye (?). Anyway, the "ugly" way to get around the core installation issues currently present was really to manually force install things, which as noted above made it possible to at least run the lcd-demo.py demo successfully, but not monitor.py. As I wasn't sure whether the above errors where hidden by other factors for other people, I figured I should post it here; hopefully @Gadgetoid will recognize and know what to do with it.

Linux 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 on Raspberry Pi 3A+