Stuck in GrovePi installation - Rpi4

Trying to get a Rpi4 to work with a grovePi kit with no success, have been lurking in the forum and testing different proposed solutions but I’m still stuck at an error when I try running:

curl -kL dexterindustries.com/update_grovepi | bash

I get:

ux-aarch64.egg/cffi/setuptools_ext.py", line 109, in _add_c_module
  File "/tmp/easy_install-i4zgAG/smbus-cffi-0.5.1/.eggs/cffi-1.16.0-py2.7-linux-aarch64.egg/cffi/_shimmed_dist_utils.py", line 16
    raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.") from ex
                                                                                                                                       ^
SyntaxError: invalid syntax

The error suggests setuptools is not installed but when checking it shows that it is properly installed for both python2 and python3:

pi@grovetest:~ $ pip show setuptools
Name: setuptools
Version: 44.1.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /home/pi/.local/lib/python2.7/site-packages
Requires: 
Required-by: 

pi@grovetest:~ $ pip3 show setuptools
Name: setuptools
Version: 68.0.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: None
Location: /home/pi/.local/lib/python3.7/site-packages
Requires: 
Required-by: 

I also ran some other diagnostics I saw in a similar post in case it helps figuring out where the issue is.

pi@grovetest:~ $ whoami
pi
pi@grovetest:~ $ groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio lpadmin
pi@grovetest:~ $ uname -a
Linux grovetest 5.10.103-v8+ #1529 SMP PREEMPT Tue Mar 8 12:26:46 GMT 2022 aarch64 GNU/Linux
pi@grovetest:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@grovetest:~ $ i2cdetect -l
i2c-1	i2c       	bcm2835 (i2c@7e804000)          	I2C adapter
pi@grovetest:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- 62 -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: 70 -- -- -- -- -- -- --

I would be super grateful if anyone here could help me with this!

2 Likes

I never got around exactly this problem and, after trying different things for 3 days, ended up using system image from this post:

Probably more knowledgeable people can help you better but this solved my problems with dependencies from Python2/3 right away.

4 Likes

@tommy.trojan,

What OS are you trying to use?

At the present time there are pretty specific requirements for the particular OS to use and if you aren’t using it, you are pretty much hozed as @noobsonfire8 found out:

Try that and let us know what happens.

2 Likes

Look at this posting. . .

https://forum.dexterindustries.com/t/grove-pi-doesnt-work-do-not-use-raspbian-bullseye/8664

. . . as well as @cyclicalobsessive’s many useful posts on the subject for help getting it to work.

Note that the only operating system that currently works with the Grove-Pi is this Raspbian image, after you “curl” the appropriate Grove-Pi libraries into it.

Viz.:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy

Please get back to us with your ultimate solution, (or continuing problems), so others can learn from your efforts too.

3 Likes

NO, NOT THAT LEGACY, AFAIK

The correct link to the Legacy that I have seen folks have success is:

https://downloads.raspberrypi.com/raspios_oldstable_armhf/images/raspios_oldstable_armhf-2023-05-03/

Please follow this post very carefully:

3 Likes

Feel free to update my (pinned) posting with the correct information so others won’t be as confused as me. :wink:

3 Likes

Hi All,

Thanks for all the help provided, for the OS im actually using the Buster image @cyclicalobsessive linked in this post. Here are the details:

pi@grovetest:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

after installing that image I pretty much just sudo update, use raspi-config to enable I2C and try to run the curl install which led me to the error in the original post.

3 Likes

please reply with the result from

python3 --version
python3
>> import grovepi
(ctrl-D)

between
```

``` (three back quotes)

Also please post the result of:

curl -kL dexterindustries.com/update_sensors | bash

then perform:

=== R4R_Tools (for I2C_mutex)
$ sudo git clone https://github.com/DexterInd/RFR_Tools.git /home/pi/Dexter/lib/Dexter/RFR_Tools
$ sudo apt-get install libffi-dev
$ cd /home/pi/Dexter/lib/Dexter//RFR_Tools/miscellaneous/
$ sudo python3 setup.py install
$ sudo reboot

and then try again:

python3
>> import grovepi
(ctrl-D)
3 Likes

Thanks for the reply again, here are the results for the commands provided:

python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import grovepi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'grovepi'
>>> 
curl -kL dexterindustries.com/update_sensors | bash
...
  File "/tmp/easy_install-zkKbxN/smbus-cffi-0.5.1/.eggs/cffi-1.16.0-py2.7-linux-armv7l.egg/cffi/_shimmed_dist_utils.py", line 16
    raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.") from ex
                                                                                                                                       ^
SyntaxError: invalid syntax

...
Installed /usr/local/lib/python3.7/dist-packages/Line_Follower-1.0.0-py3.7.egg
Processing dependencies for Line-Follower==1.0.0
Searching for python-periphery==2.4.1
Best match: python-periphery 2.4.1
Processing python_periphery-2.4.1-py3.7.egg
python-periphery 2.4.1 is already the active version in easy-install.pth

Using /usr/local/lib/python3.7/dist-packages/python_periphery-2.4.1-py3.7.egg
Finished processing dependencies for Line-Follower==1.0.0
Configuring the red line follower in DI_Sensors installation
Done configuring the red line follower in DI_Sensors installation
pi@grovetest:~ $ $ sudo git clone https://github.com/DexterInd/RFR_Tools.git /home/pi/Dexter/lib/Dexter/RFR_Tools
-bash: $: command not found
pi@grovetest:~ $ $ sudo apt-get install libffi-dev
-bash: $: command not found
pi@grovetest:~ $ $ cd /home/pi/Dexter/lib/Dexter//RFR_Tools/miscellaneous/
-bash: $: command not found
pi@grovetest:~ $ $ sudo python3 setup.py install
-bash: $: command not found
pi@grovetest:~ $ sudo git clone https://github.com/DexterInd/RFR_Tools.git /home/pi/Dexter/lib/Dexter/RFR_Tools
fatal: destination path '/home/pi/Dexter/lib/Dexter/RFR_Tools' already exists and is not an empty directory.
pi@grovetest:~ $ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libffi-dev is already the newest version (3.2.1-9).
0 upgraded, 0 newly installed, 0 to remove and 331 not upgraded.
pi@grovetest:~ $ cd /home/pi/Dexter/lib/Dexter//RFR_Tools/miscellaneous/
pi@grovetest:~/Dexter/lib/Dexter/RFR_Tools/miscellaneous $ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
writing Dexter_AutoDetection_and_I2C_Mutex.egg-info/PKG-INFO
writing dependency_links to Dexter_AutoDetection_and_I2C_Mutex.egg-info/dependency_links.txt
writing requirements to Dexter_AutoDetection_and_I2C_Mutex.egg-info/requires.txt
writing top-level names to Dexter_AutoDetection_and_I2C_Mutex.egg-info/top_level.txt
reading manifest file 'Dexter_AutoDetection_and_I2C_Mutex.egg-info/SOURCES.txt'
writing manifest file 'Dexter_AutoDetection_and_I2C_Mutex.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build/lib
copying auto_detect_robot.py -> build/lib
copying auto_detect_rpi.py -> build/lib
copying I2C_mutex.py -> build/lib
copying di_i2c.py -> build/lib
copying di_mutex.py -> build/lib
creating build/bdist.linux-armv7l/egg
copying build/lib/auto_detect_robot.py -> build/bdist.linux-armv7l/egg
copying build/lib/di_i2c.py -> build/bdist.linux-armv7l/egg
copying build/lib/di_mutex.py -> build/bdist.linux-armv7l/egg
copying build/lib/I2C_mutex.py -> build/bdist.linux-armv7l/egg
copying build/lib/auto_detect_rpi.py -> build/bdist.linux-armv7l/egg
byte-compiling build/bdist.linux-armv7l/egg/auto_detect_robot.py to auto_detect_robot.cpython-37.pyc
byte-compiling build/bdist.linux-armv7l/egg/di_i2c.py to di_i2c.cpython-37.pyc
byte-compiling build/bdist.linux-armv7l/egg/di_mutex.py to di_mutex.cpython-37.pyc
byte-compiling build/bdist.linux-armv7l/egg/I2C_mutex.py to I2C_mutex.cpython-37.pyc
byte-compiling build/bdist.linux-armv7l/egg/auto_detect_rpi.py to auto_detect_rpi.cpython-37.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying Dexter_AutoDetection_and_I2C_Mutex.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Dexter_AutoDetection_and_I2C_Mutex.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Dexter_AutoDetection_and_I2C_Mutex.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Dexter_AutoDetection_and_I2C_Mutex.egg-info/requires.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying Dexter_AutoDetection_and_I2C_Mutex.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/Dexter_AutoDetection_and_I2C_Mutex-1.3.2-py3.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing Dexter_AutoDetection_and_I2C_Mutex-1.3.2-py3.7.egg
Copying Dexter_AutoDetection_and_I2C_Mutex-1.3.2-py3.7.egg to /usr/local/lib/python3.7/dist-packages
Adding Dexter-AutoDetection-and-I2C-Mutex 1.3.2 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/Dexter_AutoDetection_and_I2C_Mutex-1.3.2-py3.7.egg
Processing dependencies for Dexter-AutoDetection-and-I2C-Mutex==1.3.2
Searching for wiringpi
Reading https://pypi.org/simple/wiringpi/
Downloading https://files.pythonhosted.org/packages/ac/6d/29381c226c296df5896c1e6855acbd59d40fa8b7ee6e82b289cb9dd940ef/wiringpi-2.60.1-cp37-cp37m-linux_armv7l.whl#sha256=7a54e5a879b828eb113228b835a5dbf13695aae06c206ec11940641346fabc24
Best match: wiringpi 2.60.1
Processing wiringpi-2.60.1-cp37-cp37m-linux_armv7l.whl
Installing wiringpi-2.60.1-cp37-cp37m-linux_armv7l.whl to /usr/local/lib/python3.7/dist-packages
Adding wiringpi 2.60.1 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/wiringpi-2.60.1-py3.7-linux-armv7l.egg
Searching for smbus-cffi
Reading https://pypi.org/simple/smbus-cffi/
Downloading https://files.pythonhosted.org/packages/29/3d/a50bd997979c7554c9c571753d34e976eb88ebf41d3a66accb2468bd3c69/smbus-cffi-0.5.1.tar.gz#sha256=fb4195aaabfc01586863f60d3190b5cb1bf8f12622fd597e23e48768dad6bde8
Best match: smbus-cffi 0.5.1
Processing smbus-cffi-0.5.1.tar.gz
Writing /tmp/easy_install-nhq2e7yy/smbus-cffi-0.5.1/setup.cfg
Running smbus-cffi-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-nhq2e7yy/smbus-cffi-0.5.1/egg-dist-tmp-utb1okhg

Installed /tmp/easy_install-nhq2e7yy/smbus-cffi-0.5.1/.eggs/cffi-1.16.0-py3.7-linux-armv7l.egg
Searching for pycparser
Reading https://pypi.org/simple/pycparser/
Downloading https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl#sha256=8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9
Best match: pycparser 2.21
Processing pycparser-2.21-py2.py3-none-any.whl
Installing pycparser-2.21-py2.py3-none-any.whl to /tmp/easy_install-nhq2e7yy/smbus-cffi-0.5.1/.eggs

Installed /tmp/easy_install-nhq2e7yy/smbus-cffi-0.5.1/.eggs/pycparser-2.21-py3.7.egg
creating /usr/local/lib/python3.7/dist-packages/smbus_cffi-0.5.1-py3.7-linux-armv7l.egg
Extracting smbus_cffi-0.5.1-py3.7-linux-armv7l.egg to /usr/local/lib/python3.7/dist-packages
Adding smbus-cffi 0.5.1 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/smbus_cffi-0.5.1-py3.7-linux-armv7l.egg
Searching for cffi>=1.1.0
Reading https://pypi.org/simple/cffi/
Downloading https://files.pythonhosted.org/packages/68/ce/95b0bae7968c65473e1298efb042e10cafc7bafc14d9e4f154008241c91d/cffi-1.16.0.tar.gz#sha256=bcb3ef43e58665bbda2fb198698fcae6776483e0c4a631aa5647806c25e02cc0
Best match: cffi 1.16.0
Processing cffi-1.16.0.tar.gz
Writing /tmp/easy_install-zl793jyl/cffi-1.16.0/setup.cfg
Running cffi-1.16.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-zl793jyl/cffi-1.16.0/egg-dist-tmp-bwxq02_7
creating /usr/local/lib/python3.7/dist-packages/cffi-1.16.0-py3.7-linux-armv7l.egg
Extracting cffi-1.16.0-py3.7-linux-armv7l.egg to /usr/local/lib/python3.7/dist-packages
Adding cffi 1.16.0 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/cffi-1.16.0-py3.7-linux-armv7l.egg
Searching for pycparser
Reading https://pypi.org/simple/pycparser/
Downloading https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl#sha256=8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9
Best match: pycparser 2.21
Processing pycparser-2.21-py2.py3-none-any.whl
Installing pycparser-2.21-py2.py3-none-any.whl to /usr/local/lib/python3.7/dist-packages
Adding pycparser 2.21 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/pycparser-2.21-py3.7.egg
Searching for python-periphery==2.4.1
Best match: python-periphery 2.4.1
Processing python_periphery-2.4.1-py3.7.egg
python-periphery 2.4.1 is already the active version in easy-install.pth

Using /usr/local/lib/python3.7/dist-packages/python_periphery-2.4.1-py3.7.egg
Searching for pyserial==3.4
Best match: pyserial 3.4
Adding pyserial 3.4 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Finished processing dependencies for Dexter-AutoDetection-and-I2C-Mutex==1.3.2

trying importing grovepi again with no succes:

 python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import grovepi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'grovepi'
>>> 
3 Likes

I really don’t know what to tell you - start over fresh?

Wait - when you did uname -a it said Aarch64 - that is a 64bit OS not the 32bit version. Where did you get that OS?

Or maybe now you are on the right one?

uname -a      <<should see armv7l GNU/Linux  not aarch64  right?

The fact that you got the DI_i2c eggs installed means you are close, I think.

sudo apt install --fix-broken
sudo apt install python3-dev
curl -kL dexterindustries.com/update_grovepi | bash
sudo reboot

python 
>>>import grovepi
(ctrl d)

python3
>>>import grovepi
(ctrl d)
3 Likes

Thanks for all the help, decided to start from a fresh install and managed to get multiple Rpi4 and Rpi3 working!

Here’s the step by step in case anyone finds themselves in this situation:

  • Flash the 2023-05-03-raspios-buster-armhf.img to the rpi keeping pi as the username
  • Activate the I2C interface
  • Run:
sudo apt update
sudo curl -kL dexterindustries.com/update_grovepi | bash

you might get the following error multiple times but we just ingnore it for now

raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.")
  • We install a missing package
    pip install python-periphery

  • Reboot your pi
    sudo reboot

*Finally we ssh back and go to the Python examples directory and read the version on our grovepi to make sure the shield is communicating correctly.

	cd ~/Dexter/GrovePi/Software/Python
	python grove_firmware_version_check.py

You should see output like the following:
GrovePi has firmware version: 1.4.0

After that we tested the LED, ultrasonic ranger, rgb LCD screen, light sensor, potentiometer sensor and all of them seem to be working.

3 Likes

Superb - We’ll point all “GrovePi Seekers” to your post from now on.

With the link to the image:

https://downloads.raspberrypi.com/raspios_oldstable_armhf/images/raspios_oldstable_armhf-2023-05-03/

3 Likes

It’s fine to use with python but it doesn’t work with python3.

pi@raspberrypi:~ $ python /home/pi/Dexter/GrovePi/Software/Python/grove_firmware_version_check.py
GrovePi has firmware version: 1.4.0
pi@raspberrypi:~ $ python3 /home/pi/Dexter/GrovePi/Software/Python/grove_firmware_version_check.py
Traceback (most recent call last):
File “/home/pi/Dexter/GrovePi/Software/Python/grove_firmware_version_check.py”, line 37, in
import grovepi
File “/home/pi/Dexter/GrovePi/Software/Python/grovepi.py”, line 54, in
import di_i2c
ModuleNotFoundError: No module named ‘di_i2c’
pi@raspberrypi:~ $

This is true even if I run the command :

pip3 install python-periphery

To install the missing library on python3.

2 Likes

I have found a manual installation solution for python3 working with version 10 (Buster) and also for version 11 (the legacy version) but not yet for version 12. Installation is via this script :

#!/bin/bash
sudo apt-get update
if grep -q ^10\. /etc/debian_version
then
sudo apt-get install -y --no- install -recommends git \
python3 python3-dev python3-setuptools python3-pip \
python3-smbus python3-serial python3-rpi.gpio \
python3-numpy python3-scipy swig libffi-dev \
libncurses5 i2c-tools
sudo pip3 install python-periphery
elif grep -q ^11\. /etc/debian_version
then
sudo apt-get install -y --no- install -recommends git \
python3 python3-dev python3-setuptools python3-pip \
python3-smbus python3-serial python3-rpi.gpio \
python3-numpy python3-scipy swig libffi-dev \
libncurses5 i2c-tools
sudo pip3 install python-periphery
else
exit 0
fi
mkdir Dexter
cd Dexter
sudo apt-get install -y --no- install -recommends build-essential \
cmake flex bison libelf-dev libusb-dev libhidapi-dev libftdi1-dev \
libreadline-dev libserialport-dev
git clone https: //github .com /avrdudes/avrdude .git
cd avrdude
. /build .sh
sudo cmake --build build_linux --target install
sudo sh -c "cat >>/usr/local/etc/avrdude.conf" <<EOF
programmer
id = "gpio" ;
desc = "Use the Linux sysfs interface to bitbang GPIO lines" ;
type = "linuxgpio" ;
prog_modes = PM_ISP;
connection_type = linuxgpio;
reset = 8;
sck = 11;
sdo = 10;
sdi = 9;
;
EOF
cd ..
git clone --recurse-submodules https: //github .com /WiringPi/WiringPi-Python .git
cd WiringPi-Python
sudo python3 setup.py install
cd ..
git clone https: //github .com /DexterInd/RFR_Tools .git
cd RFR_Tools /miscellaneous
cat <<EOF >setup.py
#!/usr/bin/env python
#
'' '
## License
# https://www.dexterindustries.com
#
# Copyright (c) 2020 Dexter Industries
# Released under the MIT license (http://choosealicense.com/licenses/mit/).
# For more information see https://github.com/DexterInd/DI_Sensors/blob/master/LICENSE.md
'' '
import setuptools
setuptools.setup(
name= "Dexter_AutoDetection_and_I2C_Mutex" ,
version = "1.3.2" ,
description= "Dexter Industries Robot Autodetection and I2C Mutex Security" ,
author= "Dexter Industries" ,
url= "http://www.dexterindustries.com/GoPiGo/" ,
py_modules=[ 'auto_detect_robot' , 'auto_detect_rpi' , 'I2C_mutex' , 'di_i2c' , 'di_mutex' ],
install_requires=[],
)
EOF
sudo python3 setup.py install
cd ../..
git clone --branch master --single-branch https: //github .com /DexterInd/GrovePi .git
cd GrovePi /Software/Python
echo >requirements.txt
sudo python3 setup.py install
cd ../../..
cd ..
if i2cdetect -y 1
then
python3 Dexter /GrovePi/Software/Python/grove_firmware_version_check .py
else
if ! grep -q ^ 'dtparam=i2c_arm=on' /boot/config .txt
then
sudo raspi-config nonint do_i2c 0
fi
echo
echo 'reboot the Raspeberry PI with the command "sudo reboot"'
echo
fi

It would be great if we could also find a solution for version 12 of Raspberry Pi OS.

3 Likes

I believe the GrovePi uses the same DI_Sensors, di_i2c, and RFR_Tools as the GoPiGo so my investigation should prove useful.

This is what I had to do for the GoPiGo3 Python setup for Pi OS Bookworm for RPi4:

  • changed the setup required packages lists
  • Removed software I2C (depended on wiringpi not avail on bookworm)
  • Updated distance_sensor and easy_distance_sensor to default to hardware I2C

I did this on an “Upgrade to Bookworm” but the changes should be the same.

These changes were not sufficient for running PiOS Bookworm on Raspberry Pi5 where an extensive GPIO interface change is required.

2 Likes

The problem is that the original GPG drivers and utilities were written around the time of Moses when there were wooden ships and iron men - and Python 2.n was the happening thing.

Nowadays, Python 2.n is a fossilized relic of its former self, and even things like Python3.7 are considered Ancient History.TM

Unfortunately, refactoring all the associated code to run on Python 3.n, especially the wacked-out versions they have now that stamp their feet and INSIST on Docker containers, is a non-trivial effort by orders of magnitude.

@cyclicalobsessive is working on adapting the GoPiGo libraries for the Pi-5, and porting the Python code was SO GNARLY, that he actually dropped back into the base-level C++ code because it was easier!!

IMHO, any time someone deliberately chooses to program in C++ because Python is more difficult - well you really need to adjust your thinking about the Python code.

You’re welcome to try if you wish. . . . :man_facepalming:  Me?  I’ll be over here doing something less stressful - like pounding on perclorate soaked wooden furniture!

2 Likes

Is not working (again??) i get the same error on both raspi 3b and 4:

Installed /usr/local/lib/python2.7/dist-packages/grovepi-1.4.1-py2.7.egg
Processing dependencies for grovepi==1.4.1
Searching for smbus-cffi
Reading https://pypi.org/simple/smbus-cffi/
Downloading https://files.pythonhosted.org/packages/29/3d/a50bd997979c7554c9c571753d34e976eb88ebf41d3a66accb2468bd3c69/smbus-cffi-0.5.1.tar.gz#sha256=fb4195aaabfc01586863f60d3190b5cb1bf8f12622fd597e23e48768dad6bde8
Best match: smbus-cffi 0.5.1
Processing smbus-cffi-0.5.1.tar.gz
Writing /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/setup.cfg
Running smbus-cffi-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/egg-dist-tmp-Lyuc4Y
  File "build/bdist.linux-armv7l/egg/cffi/_shimmed_dist_utils.py", line 16
    raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.") from ex
                                                                                                                                       ^
SyntaxError: invalid syntax

  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/_shimmed_dist_utils.py", line 16
    raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.") from ex
                                                                                                                                       ^
SyntaxError: invalid syntax


Installed /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg
Searching for pycparser
Reading https://pypi.org/simple/pycparser/
Downloading https://files.pythonhosted.org/packages/1d/b2/31537cf4b1ca988837256c910a668b553fceb8f069bedc4b1c826024b52c/pycparser-2.22.tar.gz#sha256=491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6
Best match: pycparser 2.22
Processing pycparser-2.22.tar.gz
Writing /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/temp/easy_install-RZceae/pycparser-2.22/setup.cfg
Running pycparser-2.22/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/temp/easy_install-RZceae/pycparser-2.22/egg-dist-tmp-chOY1s
warning: no previously-included files found matching 'setup.pyc'
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
pycparser.ply.lex: module references __file__
pycparser.ply.lex: module MAY be using inspect.getsourcefile
pycparser.ply.yacc: module references __file__
pycparser.ply.yacc: module MAY be using inspect.getsourcefile
pycparser.ply.yacc: module MAY be using inspect.stack
pycparser.ply.ygen: module references __file__
creating /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg
Extracting pycparser-2.22-py2.7.egg to /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs

Installed /tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg
Traceback (most recent call last):
  File "setup.py", line 125, in <module>
    test_suite = 'test_script.test_suite.TestMethods'
  File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 443, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 685, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 732, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 777, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/setup.py", line 48, in <module>
    import os
  File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 447, in __init__
    k: v for k, v in attrs.items()
  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
    self.finalize_options()
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 739, in finalize_options
    ep.load()(self, ep.name, value)
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/setuptools_ext.py", line 216, in cffi_modules
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/setuptools_ext.py", line 25, in execfile
  File "smbus_cffi_build.py", line 60, in <module>
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/api.py", line 112, in cdef
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/api.py", line 126, in _cdef
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/cparser.py", line 390, in parse
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/cparser.py", line 395, in _internal_parse
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/cparser.py", line 337, in _parse
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/cffi-1.17.0rc1-py2.7-linux-armv7l.egg/cffi/cparser.py", line 53, in _get_parser
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg/pycparser/c_parser.py", line 86, in __init__
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg/pycparser/c_lexer.py", line 65, in build
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg/pycparser/ply/lex.py", line 914, in lex
  File "/tmp/easy_install-fw2XEt/smbus-cffi-0.5.1/.eggs/pycparser-2.22-py2.7.egg/pycparser/ply/lex.py", line 233, in readtab
  File "/usr/lib/python2.7/re.py", line 194, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python2.7/re.py", line 249, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python2.7/sre_compile.py", line 583, in compile
    "sorry, but this version only supports 100 named groups"
AssertionError: sorry, but this version only supports 100 named groups

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- 08 -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --  

When i try to run the firmware detection it gets stuck…
The grovepi import works with python but not with python3

any clues? updates? weapons of selfdestruction?

al the best

2 Likes

Grove doesn’t work with Python 3 AFAIK.

Also, it doesn’t look like the Grove board is showing up in the i2c test.

1 Like

You need to install setuptools for these scripts to work.

Also make sure SPI and i2c are enabled in raspi-config.

1 Like