GPIO Related Issues - Installing VisionFive.gpio

I am running the latest Debian version (202409) and have successfully installed the VisionFive.gpio library with earlier versions but running into problems since the upgrade.
I am following the application note Preparing Software

Have successfully installed pip and also the two libraries as per the instruction ‘apt install libxml2-dev libxslt-dev’ (although I did get a warning that 'Note, selecting ‘libxslt1-dev’ instead of ‘libxslt-dev’

The next step is where I run into trouble. When I run ‘python3 -m pip install requests wget bs4’ I receive a message as follows.
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I then ran ‘python3 -m pip install requests wget bs4’ again and added ‘–break-system-packages’ and it appears to have worked.

Then, I created the Install_VisionFive_gpio.py script in nano but when I run the command ‘python3 Install_VisionFive_gpio.py’ I receive the environment is externally managed error again and adding the ‘–break-system-package’ to the end of the command does not help.

Is there something I need to change in the Install_VisionFive_gpio.py script that I need to change?

Hi Moonlight
First,Regarding “apt install libxslt dev prompts to install libxst1 dev”: libxst1 dev is one of the versions of libxslt dev。
Then,I think the proplem in pip 。Suggest reinstalling according to the following steps:
step1:Uninstall pip and Related Packages
#sudo apt-get remove --purge python3-pip
step2:Clean Up Residual Dependencies
#sudo apt-get autoremove
step3:Clean Up Residual Configuration Files and Cache
#rm -rf ~/.cache/pip
#rm -rf /usr/local/lib/python3./dist-packages/
#rm -rf /usr/local/bin/pip*
step4:Reinstall pip Using apt
# apt update
# apt-get install python3-pip
Finally, upgrading VisionFive.gpio requires uninstalling the original whl package first.By using this command:python3 -m pip uninstall VisionFive.gpio

Thanks for you time and knowledge. I completed all the steps successfully and when I begin to prepare the software before running the VisionFive.gpio I run into trouble again. Below is a copy of the output.

user@starfive:~$ python3 -m pip uninstall VisionFive.gpio
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
user@starfive:~$ python3 -m pip uninstall VisionFive.gpio --break-system-packages
WARNING: Skipping VisionFive.gpio as it is not installed.
user@starfive:~$ sudo apt install libxml2-dev libxslt-dev
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Note, selecting ‘libxslt1-dev’ instead of ‘libxslt-dev’
libxml2-dev is already the newest version (2.9.14+dfsg-1.2).
libxslt1-dev is already the newest version (1.1.35-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
user@starfive:~$ python3 -m pip install requests wget bs4
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
user@starfive:~$

I think the proplem in python3.11,VisionFive.gpio the latest version 1.3.2 can only run on Python 3.10.Suggest reinstalling according to the following steps:
Step1:Edit /etc/apt/sources.list,add following content
#nano /etc/apt/sources.list
deb Index of /debian unstable main contrib non-free
deb-src Index of /debian unstable main contrib non-free

deb Index of /debian-security unstable/updates main contrib non-free
deb-src http://deb.deScriptsbian.org/debian-security/ unstable/updates main contrib non-free
Step2:Using Scripts Add additional configuration files and update deb list using shell scripts:
#!/bin/bash

if [ -e “/etc/apt/sources.list.d/starfive-sid.list” ]; then
sed -i ‘/^#/! s/^/#/’ /etc/apt/sources.list.d/starfive-sid.list
fi

DEBIAN_FRONTEND=noninteractive apt install wget gpg debian-ports-archive-keyring -y
wget https://debianrepo.starfivetech.com/StarFive-debian-repo.key

apt-key add StarFive-debian-repo.key
apt-key list
apt-key export C3966193CFCD6206234F6987D98DFD30F9D9F1B0 | gpg --dearmour -o /etc/apt/trusted.gpg.d/starfive-debian-repo.gpg
rm StarFive-debian-repo.key

echo “deb https://debianrepo.starfivetech.com starfive-debian main” >> /etc/apt/sources.list.d/starfive-sid.list
echo “deb https://debianrepo.starfivetech.com VisionFive2 contrib restricted” >> /etc/apt/sources.list.d/starfive-sid.list

apt update -y
Step3:Install python3.10
apt install python3.10 python3.10-dev python3.10-venv
&Check python3.10 version
#python3.10 --version
Step4:Install the corresponding pip using shell scripts
#wget https://bootstrap.pypa.io/get-pip.py
&Please note to use the corresponding Python version
#python3.10 get-pip.py
&Check pip version
#pip3.10 version
Stp5:Install VisionFive.gpio using python3.10
#python3.10 -m pip Install_VisionFive_gpio.py

Hi, there’s something wrong with the links in the sources.list I copied and pasted the four links and ran the shell script but get the following errors. Also fixed a problem in the fourth line
’ deb-src http://deb.deScriptsbian.org/debian-security/ unstable/updates main contrib non-free’

E: Type ‘“deb’ is not known on line 3 in source list /etc/apt/sources.list.d/starfive-sid.list
E: The list of sources could not be read.

Can u check please? I assume Step 2 is to create a shell script as per your instructions and to execute the script?

Srroy, ’ deb-src http://deb.descriptsbian.org/debian-security/ unstable/updates main contrib non-free’ is can not used,can be deleted.but It doesn’t matter,If you can install Python 3.10 and its corresponding pip.

I now have python 3.10 installed
user@starfive:~$ python3.10 --version
Python 3.10.12
and pip installed
user@starfive:~$ pip3.10 --version
pip 24.2 from /home/user/.local/lib/python3.10/site-packages/pip (python 3.10)

Followed the method outlined here VisionFive.gpio · PyPI
and VisionFive.gpio-1.3.2 is successfully installed.

Thanks for your persistence in helping solve this.

Cheers David

1 Like