PacktPublishing / Intelligent-Workloads-at-the-Edge

Intelligent Workloads at the Edge, published by Packt
MIT License
6 stars 11 forks source link

com.hbs.hub.ReadSenseHAT=1.0.0 Packages with conflicting dependencies #2

Open AlvaroPuente opened 2 years ago

AlvaroPuente commented 2 years ago

Good afternoon,

I am Álvaro Puente, a student at the University of Valladolid and I am using your book as a support for my final degree project. The thing is that, when it comes to deploy, both com.hbs.hub.ReadSenseHAT and com.hbs.hub.WriteSenseHAT, fail to deploy and go to BROKEN state.

I've been looking into the logs and I think the problem can be found in the recipe, specifically in the "install" section. This is due to version conflicts of the packages to be installed (in the file requitements.txt). I don't know if fixing that would make everything work correctly or if there would be something else or, on the contrary, it could be my fault.

I would be grateful to receive feedback on this issue. I'm attaching a couple of interesting screenshots I've seen in com.hbs.hub.ReadSenseHAT.log

PS: I am completing the book with a Raspberry Pi 3B and the SenseHAT device.

Error1 Error2
TheRyanBurke commented 2 years ago

Acknowledging receipt of the issue. We will troubleshoot on our end this week.

TheRyanBurke commented 2 years ago

Hi Álvaro, there is an issue with the pip dependency tree that is resolved by updating the versions of awsiotsdk and awscrt in requirements.txt. Fix is below and I will commit a change to the code this week.

However, there was one more blocking issue after resolving that. I'm still tracking down the root cause of the second issue where RTIMULib fails to build in the virtual Python environment. Something related to newer RPi OS, newer Python3 version 3.9 (we wrote the labs originally with 3.7), and the virtual Python environment created by venv. For now, you can get the components working by removing the use of venv. While this isn't a best practice for production, it is fine on a test RPi device. I will continue troubleshooting to see if I can get venv working with latest RPi OS and Python 3.9.

You can make the following changes to unblock deployment of the components that interact with SenseHAT.

chapter3/artifacts/com.hbs.hub.ReadSenseHAT/1.0.0/requirements.txt (drop the lines that no longer appear below, update awscrt and awsiotsdk versions)

awscrt==0.13.11
awsiotsdk==1.11.1
numpy==1.21.0
Pillow==8.2.0

recipes/com.hbs.hub.ReadSenseHAT-1.0.0.json Lifecycle Install script becomes

"Script": "usermod -a -G i2c,input ggc_user && apt update && apt upgra
de -y && apt install python3 libatlas-base-dev -y && python -m pip install -r {a
rtifacts:path}/requirements.txt"

recipes/com.hbs.hub.ReadSenseHAT-1.0.0.json Run script becomes

"Script": "python {artifacts:path}/read_senseHAT.py"

You will need to make similar changes to the WriteSenseHAT-1.0.0.json file and the artifact requirements.txt.

AlvaroPuente commented 2 years ago

Hello again @TheRyanBurke,

Thanks for the update. I have applied the changes but still the components go to BROKEN state. Again, I am attaching from com.hbs.hub.ReadSenseHAT.log the problem that arises. image

TheRyanBurke commented 2 years ago

This is one of the reasons using venv is preferred :)

It looks like your device has Pillow and numpy installed in the global Python packages that are earlier versions and thus incompatible with the stated requirements.txt. Python reports it won't uninstall the previous version because the Greengrass directory where the component is running is outside of /usr.

In any case, I'm reviewing the code for those components and I don't see any consumption of either Pillow or numpy in them. I won't have an opportunity to test this for another day, but you could try further slimming the requirements.txt files down to:

awscrt==0.13.11
awsiotsdk==1.11.1

and see if that results in a successful component deployment.

AlvaroPuente commented 2 years ago

It works! Thank you very much @TheRyanBurke

rajat-packt commented 2 years ago

Hey @AlvaroPuente, @TheRyanBurke, Let me know if this issue can now be closed and if there is any information regarding this, that should be mentioned in the readme if it could be beneficial for other readers too.

TheRyanBurke commented 2 years ago

Thanks, Rajat. I will file a PR to correct the issue for future readers and at that time we can close the issue.