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 ·
Show more comments
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 ·
Show more comments