VSCode Torizon: "Unable to locate python3-spidev"

Hello,

as recommended here, I tried to build a torizon container with python3-spidev.

Adding apt install python3-spidev to setup.sh as well as listing python3-spidev in extrapackages fails with:

"Unable to locate package python3-spidev"

What am I doing wrong?

Greetings @romnan,

Using the Debian package search: https://www.debian.org/distrib/packages

I couldn’t find the python3-spidev package. Though there’s a python3 spidev package install-able via pip: https://pypi.org/project/spidev/

Perhaps is this what you’re looking for?

In order to have the extension install packages via pip rather than apt you want to instead list in in requirements.txt. As stated here: https://developer.toradex.com/knowledge-base/python-development-and-debugging-on-torizon-using-visual-studio-code#Python_Project_Configuration_Files

Best Regards,
Jeremias

Ahh okay I understand now. Yes you’ll have to separately define pip based packages in requirments.txt and apt packages in setup.sh. The respective packaging command is run on each entry in each file. Therefore you need to make sure the package exists in either apt or pip.

Best Regards,
Jeremias

Hello,
thank you for answering.

I did try to install the python package “spidev” via pip first using the requirements.txt file.
Problem is that installation of spidev requires an arm-gcc compiler.

I will now try to also installing build-essentials…

I found an alternative python package (python3-spi) for which no C libraries need to be build on installation, just in case someone faces the same problem.

Not sure how to close this, if you can, please do. Thank you.

Thank you for sharing your alternative solution.