Hi, I’m new to Torizon. I’m trying to communicate with an SPI sensor using a verdin-imx8m-mini, and I’m having trouble enabling spidev in python . I’m working on Windows 11 and using VS Code extension.
I followed the steps from:
Even running # spidev_test -D /dev/verdin-spi-cs0, I can see data frames being sent on the oscilloscope. However, when I try to import spidev in Python or install it from the requirements.txt file, I get an error.
How can I properly use SPI from Python in this environment?
When I try to run my python code I receive this error
I tried to install spidev over the requirements-local, requirements-debug and requirements-release txt and in the Dockerfile using pip and apt-get.
When I debug and try to install over requeriments-release.txt I had this message
Could you please share the OS version you are currently using? You can find this information by running the tdx-info command on your module.
The issue you’re facing occurs because, by default, the container does not include the necessary cross-compilers. I was able to reproduce the issue here, and the key error message is:
15.41 aarch64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/torizon/app/.venv/include -I/usr/include/python3.11 -c spidev_module.c -o build/temp.linux-aarch64-cpython-311/spidev_module.o
15.41 error: command 'aarch64-linux-gnu-gcc' failed: No such file or directory
15.41 [end of output]
To resolve this, you’ll need to ensure that the cross-compilers and the required headers are available in the container. You can do this by updating your torizonPackages.json file as follows: