Reprise: No Module named i2c_mutex

Continuing the discussion from No module named I2C_mutex:

I just tried a fresh install of the GoPiGo libraries on a generic Buster install using the standard install scripts for the GoPiGo libraries and sensors.  When I attempted to run a simple test script that moves the servos, I received the following errors:

Python 3.7.3 (/usr/bin/python3)
>>> %Run test_servos.py
Traceback (most recent call last):
  File "/home/pi/Desktop/test_servos.py", line 1, in <module>
    import easygopigo3 as easy
  File "/usr/local/lib/python3.7/dist-packages/gopigo3-1.3.2.1-py3.7.egg/easygopigo3.py", line 13, in <module>
    import easysensors
  File "/usr/local/lib/python3.7/dist-packages/gopigo3-1.3.2.1-py3.7.egg/easysensors.py", line 1, in <module>
    from I2C_mutex import Mutex
ModuleNotFoundError: No module named 'I2C_mutex'
>>>

Following the instructions in the above referenced article, I then ran the following:

sudo apt-get install -y build-essential libi2c-dev i2c-tools python-dev python3-dev python-setuptools python3-setuptools python-pip python3-pip libffi-dev

. . . which reported that everything is current.

Then, as instructed above, I ran:

pi@raspberrypi:~/Dexter/lib/Dexter $ git clone https://github.com/DexterInd/RFR_Tools

pi@raspberrypi:~/Dexter/lib/Dexter $ cd /home/pi/Dexter/lib/Dexter/RFR_Tools/miscellaneous
pi@raspberrypi:~/Dexter/lib/Dexter/RFR_Tools/miscellaneous $ sudo python setup.py install

. . . . which generated the following error

Running smbus-cffi-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-beKJuz/smbus-cffi-0.5.1/egg-dist-tmp-h6znWW
  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-beKJuz/smbus-cffi-0.5.1/.eggs/cffi-1.17.1-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

. . . . and then

Running pycparser-2.22/setup.py -q bdist_egg --dist-dir /tmp/easy_install-beKJuz/smbus-cffi-0.5.1/temp/easy_install-Cor99x/pycparser-2.22/egg-dist-tmp-Uwp7NW
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'

. . . which was followed by an extremely long traceback which ended with:

  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

 


 

Then I ran:

pi@raspberrypi:~/Dexter/lib/Dexter/RFR_Tools/miscellaneous $ sudo python3 setup.py install

. . . which completed without errors.

Attempting to run my servo test script succeeded.

>>> %Run test_servos.py
Center Both Servos
Test Servo 1
Test Servo 2
Re-Center Both Servos
>>> 

I have created an issue on GitHub about this and have referenced this forum thread.

Has anyone else experienced this?

I do not yet know if this affects Bullseye or Bookworm as I have not yet tried installations there.  (I’m planning to follow the instructions posted by @cyclicalobsessive in his repo’s.)

1 Like

Yes Indeed

Installation target: Generic Buster image install from Raspberry Pi installation sources.

Confirmed this issue is with installing GoPiGo3 software over the 2023-05-03 32-bit Buster archive

Using … Quick install

Execution of:

curl -kL dexterindustries.com/update_gopigo3 | bash

from the GitHub - DexterInd/GoPiGo3: The GoPiGo3 is a Raspberry Pi Robot! documentation

RESULT - quiet install error only for Python3:

...
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-WNkdjK/smbus-cffi-0.5.1/setup.cfg
Running smbus-cffi-0.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-WNkdjK/smbus-cffi-0.5.1/egg-dist-tmp-msXzMM
  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-WNkdjK/smbus-cffi-0.5.1/.eggs/cffi-1.17.1-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

...

GOPIGO3 SOFTWARE INSTALLATION SUCCESSFUL.

Only good for Python2 - did not succeed for Python3

pi@Go3Bus32:~ $ python
Python 2.7.16 (default, Sep 20 2023, 07:59:17) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import I2C_mutex
>>>

 
pi@Go3Bus32:~ $ python3
Python 3.7.3 (default, Mar 23 2024, 16:12:05) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import I2C_mutex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'I2C_mutex'
>>>

Continue with the DI Sensors install (which will again fail building Dexter-AutoDetection-and-I2C-mutex egg)

curl -kL dexterindustries.com/update_sensors | bash
...
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

I2C_mutex still missing for Python3:

pi@Go3Bus32:~ $ python3
Python 3.7.3 (default, Mar 23 2024, 16:12:05) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import di_sensors
>>> import I2C_mutex
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'I2C_mutex'
>>> 

WORKAROUND - Execute:

cd ~/Dexter/lib/Dexter/RFR_Tools/miscellaneous/
sudo python3 setup.py install

RESULT:

...
Finished processing dependencies for Dexter-AutoDetection-and-I2C-Mutex==1.3.2


pi@Go3Bus32:~/Dexter/lib/Dexter/RFR_Tools/miscellaneous $ python3
Python 3.7.3 (default, Mar 23 2024, 16:12:05) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import I2C_mutex
>>> import di_sensors
>>>
1 Like