question

Mike Dorsett avatar image
Mike Dorsett asked

Problem running pip under venus os 2.72~4 on Pi

root@raspberrypi2:~# pip install spidev
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==21.1.3', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named typing

Any clues as to where 'typing' is or should be? opkg does not...

Venus OSRaspberry Pi
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

1 Answer
jeroen avatar image
jeroen answered ·

typing is a python module, in your case I would suggest to just run:

/opt/victronenergy/swupdate-scripts/set-feed.sh release
/opt/victronenergy/swupdate-scripts/check-updates.sh -update -force

Wait for reboot:

/opt/victronenergy/swupdate-scripts/resize2fs.sh
opkg update
opkg install binutils python-dev python-pip binutils packagegroup-core-buildessential
pip install spidev

As already mentioned in https://community.victronenergy.com/questions/94097/feature-request-for-venus-os-on-raspberry-pi.html.

Whatever you did to the rootfs will then be undone. NOTE: all changes you made to the rootfs will be gone!!! (but not of /data or the home of root)


Edited: it should be -update -force not only -force

6 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Mike Dorsett avatar image Mike Dorsett commented ·

Starting with a clean version of 2.71:

opkg update ran fine.

then with opkg install binutils python-dev python-pip binutils packagegroup-core-buildessential :-

Running setup.py install for spidev ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/volatile/tmp/pip-install-WLRMyv/spidev/setup.py'"'"'; __file__='"'"'/var/volatile/tmp/pip-install-WLRMyv/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /var/volatile/tmp/pip-record-6Mdq9I/install-record.txt --single-version-externally-managed --compile
cwd: /var/volatile/tmp/pip-install-WLRMyv/spidev/
Complete output (14 lines):
running install
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.linux-armv7l-2.7
arm-ve-linux-gnueabi-gcc -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c spidev_module.c -o build/temp.linux-armv7l-2.7/spidev_module.o
arm-ve-linux-gnueabi-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
error: command 'arm-ve-linux-gnueabi-gcc' failed with exit status 1
spidev_module.c:28:10: fatal error: Python.h: No such file or directory
28 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/volatile/tmp/pip-install-WLRMyv/spidev/setup.py'"'"'; __file__='"'"'/var/volatile/tmp/pip-install-WLRMyv/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /var/volatile/tmp/pip-record-6Mdq9I/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

QED.

I'm aware that Venus os is a reduced operating system, and for CCGX that's fine, but for Raspberry Pi, which developers are expected to work with, that's a problem when one wishes to use the Pi's peripherals too.

Is there a Wiki page for new developers that explains things like file structures? some of the pages I've been pointed at are useful, but out of date in some areas.

Python.h references LOTS of other small and un-necessary .h files - this is why I'm suggesting Venus pi editions should have a self contained Python.h

Thank you all for your help so far, but I still need to get spidev - or equivalent working?


0 Likes 0 ·
Mike Dorsett avatar image Mike Dorsett Mike Dorsett commented ·

Collected errors:

* opkg_download_backend: Failed to download https://updates.victronenergy.com/feeds/venus/release/packages/zeus/cortexa7hf-neon-vfpv4/gnu-config_20190501+git0+b98424c249-r0_cortexa7hf-neon-vfpv4.ipk, wget returned 4.

* opkg_install_pkg: Failed to download gnu-config. Perhaps you need to run 'opkg update'?

(insert the above after build essentials, before pip install spidev)


0 Likes 0 ·
jeroen avatar image jeroen ♦ Mike Dorsett commented ·

That is simply a download error:


Either start over completely or try running:
opkg install gnu-config --force-reinstall (perhaps run that twice, if it fails the first time)

Then run the opkg install command again.

Obviously running the pip install command with the opkg command failing is not going to work.


0 Likes 0 ·
Mike Dorsett avatar image Mike Dorsett commented ·

opkg install gnu-config --force-reinstall worked on the 2nd attempt, the plain opkg install gnu-config failed continuously yesterday.

However:-

Collecting spidev
Using cached https://files.pythonhosted.org/packages/62/56/de649e7d95f9fcfaf965a6eb937b4a46bc77ef21487c99cde1a7a0546040/spidev-3.5.tar.gz
Installing collected packages: spidev
Running setup.py install for spidev ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/volatile/tmp/pip-install-qUoLAt/spidev/setup.py'"'"'; __file__='"'"'/var/volatile/tmp/pip-install-qUoLAt/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /var/volatile/tmp/pip-record-yhZexC/install-record.txt --single-version-externally-managed --compile
cwd: /var/volatile/tmp/pip-install-qUoLAt/spidev/
Complete output (14 lines):
running install
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.linux-armv7l-2.7
arm-ve-linux-gnueabi-gcc -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c spidev_module.c -o build/temp.linux-armv7l-2.7/spidev_module.o
arm-ve-linux-gnueabi-gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
error: command 'arm-ve-linux-gnueabi-gcc' failed with exit status 1
spidev_module.c:28:10: fatal error: Python.h: No such file or directory
28 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/var/volatile/tmp/pip-install-qUoLAt/spidev/setup.py'"'"'; __file__='"'"'/var/volatile/tmp/pip-install-qUoLAt/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /var/volatile/tmp/pip-record-yhZexC/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

This is not the only package that fails asking for Python.h - trying to install other packages that use the gpio also fail for the same reason.

0 Likes 0 ·
jeroen avatar image jeroen ♦ Mike Dorsett commented ·

And did you rerun this command?


opkg install binutils python-dev python-pip binutils packagegroup-core-buildessential


Python.h and it depedencies are installed by python-dev.


0 Likes 0 ·
Mike Dorsett avatar image Mike Dorsett jeroen ♦ commented ·
No - I thought this had mostly run before, but after running, spidev now installs. Thank you.

The GPIO is still giving problems though. I'll find out if the spidev still has the bug in it, and if I can correct this.

GPIO is a separate issue. this might be controllable via the Venus interface.


0 Likes 0 ·