[SOLVED] ImportError: cannot import name Mutex


#1

I am getting this
“ImportError: cannot import name Mutex”

I did == sudo sh -c “curl -kL dexterindustries.com/update_gopigo3 | bash”

and .:/home/pi/Dexter/GoPiGo3/Software/Python:/home/pi/Dexter:

I had two RPI3, one works and one is not

following is what error:

pi@dex:~/ethan python jc-led.py Traceback (most recent call last): File "jc-led.py", line 3, in <module> import easygopigo3 as easy File "build/bdist.linux-armv7l/egg/easygopigo3.py", line 11, in <module> ImportError: cannot import name Mutex pi@dex:~/ethan


No module named I2C_mutex
#2

Hello @brutus1214
The error was reported to us last night and we’re working on a fix.

Give me a min,
Cleo


#3

You can run the following commands in a terminal.

sudo rm /usr/local/lib/python2.7/dist-packages/gopigo3*.egg
sudo rm /usr/local/lib/python3.4/dist-packages/gopigo3*.egg
cd ~/Dexter/GoPiGo3/Software/Python
sudo python setup.py install
sudo python3 setup.py install

Let me know if it fixes the issue, please
Cleo


#4

Thank you Cleo for looking into this

I tried your instructions and all command was run successfully, but same issue.


#5

Looking into this on my Saturday morning. Will report back


#6

@brutus1214

Would you mind redoing a DI Update? I think I have fixed it. I just need outside confirmation.
Also, please confirm, you’re on a GoPiGo3, and not a GoPiGo2, is that right?

Thanks,
Cleo


#7

Thank you for help again,

I am using GoPiGo3

I did


#8

Thank you for help again,

I am using GoPiGo3

I did
sudo sh -c "curl -kL dexterindustries.com/update_sensors | bash"
again
and sudo reboot

Same result

login as: pi
pi@10.10.1.22's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Apr 21 20:33:59 2018
pi@dex:~ $ cd ethan/
pi@dex:~/ethan $ python jc-led.py
Traceback (most recent call last):
  File "jc-led.py", line 3, in <module>
    import easygopigo3 as easy
  File "build/bdist.linux-armv7l/egg/easygopigo3.py", line 11, in <module>
ImportError: cannot import name Mutex

Updating GoPiGo3 library per manual instructions
#9

Hi @brutus1214,

I’m going to ask you to uninstall the GoPiGo2 packages this way:

sudo pip uninstall gopigo -y
sudo pip3 uninstall gopigo -y

And then run curl -kL dexterindustries.com/update_tools | sudo bash.

After you do this, please try importing the easygopigo3 library again.

Also, this is kind of a duplicate of:

Thank you!


#10

Dear Robert Lucian,

After yur instruction, gpg3 works.
Just curiosity, what causes this.

Also, thank you to Cleo too.
Thank you


#11

Phew!
To answer you @brutus1214, we used to have the I2C_Mutex duplicated between the GoPiGo3 and the GoPiGo2, so we moved it to a centralized place. However, it seems that the old version was still on disk and still being picked up first, instead of the new one.
So removing the old libraries fixes the issue. I had asked you to remove the libraries for GoPiGo3, but forgot about GoPiGo2.

Cleo


#12

Also,
Thanks Cleo… but after the same error, and trying the same lines of code I still get a
“ImportError: cannot import name Mutex”.

This is happening when I am trying to run the BasicRobotControl *.py files.
I simply used the explorer login, to get the RPi desktop and am mere double clikcing the *.py files to test things out.

Nothing but errors thus far.

Thanks for the help!


#13

This reply was meant to be to an upper comment.
After I got done with the rest of this thread, I followed the uninstall commands and get a different error.


#14

After attempting all the other scripts I get the same error.
I also pulled a script file from the DexterOS version and attempted to use it in the Raspbian for Robots OS (I have each loaded on separate SD cards) I get a similar error.

What I am starting to believe this is simply version of Python complaining.
This makes me think there should be a table, or some kind of a version check so that a user can know which pre-written script was built against which version of Python.

I am still learning but this is getting challenging.

I really would just like some simple blocks of code that can be loaded, tuned in python and eventually aggregated together into a larger bot type py file.

Looking forward to your suggestions.

Thanks again!


#15

Hello @joeboog

This is a totally different and unrelated error.
This particular project uses a special library to handle keyboard input. This library does not work from within Idle. If you run the script from a terminal, it should work.

You will run it with this command:
python run_this.py

Cleo