[SOLVED] GoPiGo3 Firmware problem with Virtual Environments

Hello guys! I just got my GoPiGo3 and I was about to test the basic movements. I updated the firmware to the latest version but the error that I got suggests that I should downgrade to 0.3.x. Is this downgrade necessary or is there a different way to use the movement commands with firmware 1.0.x?

Hardware: Raspberry Pi 3B+ with Raspbian Buster

Error:
(venv) pi@gopigo:~/gopi/code_v1 $ python3 MovementTest.py
Loading library without distance sensor
FATAL ERROR:
To update the firmware on Raspbian for Robots you need to run DI Software Update and choose Update Robot
Traceback (most recent call last):
File “MovementTest.py”, line 7, in
gpg = EasyGoPiGo3()
File “/home/pi/gopi/venv/lib/python3.7/site-packages/easygopigo3.py”, line 129, in init
raise e
File “/home/pi/gopi/venv/lib/python3.7/site-packages/easygopigo3.py”, line 123, in init
super(self.class, self).init()
File “/home/pi/gopi/venv/lib/python3.7/site-packages/gopigo3.py”, line 232, in init
% (FIRMWARE_VERSION_REQUIRED, vfw))
gopigo3.FirmwareVersionError: GoPiGo3 firmware needs to be version 0.3.x but is currently version 1.0.0

regards,
Manu

3 Likes

That is bizarre. . . .

I have never, and I mean NEVER EVER, seen an error asking for a firmware DOWNGRADE.

Are you sure your 'bot didn’t get into someone’s stash of weed or down an entire bottle of “Happy Jack” Daniels?  :wink:

(You gotta tell me what you did to make it do that - it is just too strange to believe. . .)

How did you install the libraries?  The path you’re using:
/home/pi/gopi/venv/lib/python3.7/site-packages/easygopigo3.py,
is absolutely unusual.

Are you using GoPiGo OS?  (Based on that path, my bet is “No”)

Unless you are doing something particular that has a special requirement for something else, (like running ROS over Ubuntu), GoPiGo O/S is the way to go.  You download it, flash it to a waiting SD card, pop it into your GoPiGo-3, and “badda-bing, badda-boom!”, you’re ready to go.

The latest and greatest version is 3.0.1 and you can download it from:
https://gopigo.io/downloads/gopigo_os

The GoPiGo OS support page is here:
https://gopigo.io/gopigo-os-v-3-0-1/

. . . and the main GoPiGo page is located here:
https://gopigo.io

Let us know what’s happening.

2 Likes

After installing Raspbian Buster and made a folder called gopi with an virtual environment venv. In this environment I am installing everything that I need for my work with python.
I just fixed a problem with my environment where the pi couldn’t find python modules that where install outside the environment. Other then that, I don’t know what could cause this error.

The code I wanted to run is just the default gopigo tutorial:

import time
from easygopigo3 import EasyGoPiGo3

gpg will be the GoPiGo3 object.
gpg = EasyGoPiGo3()
print(“Move the motors forward freely for 1 second.”)
gpg.forward()
time.sleep(1)
gpg.stop()

2 Likes

Why are you doing such a customized installation with virtual environments?

The GoPiGo libraries expect things to be installed in certain places an to be run by the “pi” user.  I do not know if it supports virtual environments.

Let’s take a step back and why don’t you give us “the big picture”.  What is it that you want to accomplish overall, and what are the requirements for it?

2 Likes

I am writing my bachelors degree and my job is to build a robot that is able to detect lanes, drives through them and avoids certain obstacles. My hardware is the raspberry pi 3b+ with the raspberry pi cam v2 and the gopigo3.

I never intended to use Buster in the first place. I started using Raspbian Bullseye but that bugged the s*** out of the Raspberry Pi Cam. So I switched to the provided microSD and used the OS that is preinstalled on it (GoPiGo OS, i guess). That resulted in an OS that couldn’t be updated and that I could’t install anything on it (i don’t really know why). So I installed Buster, which my cam really likes, but now the GoPiGo hates me.

2 Likes

This indicates to me that you have very, very old GoPiGo3 code.

Try updating your venv per

And reboot

You must be the “pi” user to succeed.

And stick with buster will be the easiest for opencv also.

2 Likes

I don’t know what was on the SD card you received.  If you bought it recently, it should have been GoPiGo OS.

================

GoPiGo O/S. right out of the box, is designed to be a stand-alone access point that can be used by teachers in the classroom.

You can set up the GoPiGo to use a local network.

Instructions on how to do that can be found here:

IMPORTANT  WARNING
Once you get the GoPiGo connected to the network, do NOT update the software as that may cause the robotic functionality to fail.

If you ABSOLUTELY MUST update the software, you must open a terminal window first and apt-mark hold pigpio pgpio-tools pigpiod to prevent them from being touched.  I am currently researching this issue and I cannot guarantee that this won’t affect the robot somehow.

If you do update the robot, and you have problems that didn’t exist before updating, please post here and let us know.

2 Likes

This is what I did:

  • curl -kL dexterindustries.com/update_sensors | bash
    I am not using Dexter sensors, but I got this error before “No module named ‘di_sensors’
    Importing di_sensors error: No module named ‘di_sensors’”

  • curl -kL dexterindustries.com/update_gopigo3 | bash -s – --user-local --bypass-gui-installation
    I got this error:
    TEST FAILED: /home/pi/.local/lib/python3.7/site-packages/ does NOT support .pth files
    error: bad install directory or PYTHONPATH
    You are attempting to install a package to a directory that is not
    on PYTHONPATH and which Python does not read “.pth” files from. The
    installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

    /home/pi/.local/lib/python3.7/site-packages/
    and your PYTHONPATH environment variable currently contains:

    ‘’

  • I “fixed” that with this: export PYTHONPATH="/home/pi/.local/lib/python3.7/site-packages
    After that the virtual environment installation went through with no errors.

Now when I am testing the movement of the GoPiGo, I get this error:

from easygopigo3 import EasyGoPiGo3
Traceback (most recent call last):
File “”, line 1, in
File “/home/pi/.local/lib/python3.7/site-packages/gopigo3-1.3.0-py3.7.egg/easygopigo3.py”, line 13, in
except ImportError:
File “/home/pi/.local/lib/python3.7/site-packages/gopigo3-1.3.0-py3.7.egg/easysensors.py”, line 1, in
ImportError: cannot import name ‘Mutex’ from ‘I2C_mutex’ (/home/pi/gopi/venv/lib/python3.7/site-packages/I2C_mutex.py

To be fair, I2C was disabled, but after the reboot this beautiful error is back:

(venv) pi@gopigo:~/gopi/code_v1 $ python3 MovementTest.py
Loading library without distance sensor
FATAL ERROR:
To update the firmware on Raspbian for Robots you need to run DI Software Update and choose Update Robot
Traceback (most recent call last):
File “MovementTest.py”, line 7, in
gpg = EasyGoPiGo3()
File “/home/pi/gopi/venv/lib/python3.7/site-packages/easygopigo3.py”, line 129, in init
raise e
File “/home/pi/gopi/venv/lib/python3.7/site-packages/easygopigo3.py”, line 123, in init
super(self.class, self).init()
File “/home/pi/gopi/venv/lib/python3.7/site-packages/gopigo3.py”, line 232, in init
% (FIRMWARE_VERSION_REQUIRED, vfw))
gopigo3.FirmwareVersionError: GoPiGo3 firmware needs to be version 0.3.x but is currently version 1.0.0

3 Likes

In my virtual environment the module EasyGoPiGo3 isn’t available
(venv) pi@gopigo:~/gopi/code_v1 $ 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 EasyGoPiGo3
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘EasyGoPiGo3’

3 Likes

@superbam,
You are doing your work on the robot itself, aren’t you?  You’re not trying to simulate the robot on a different system?

I am struggling to understand the need for a virtual environment. If you download and install the latest GoPiGo O/S and configure it to work on your local network as noted above, it should work wonderfully.  It seems to me that you are making things needlessly complex for reasons that I don’t understand.

Before you try getting complicated, try the simple method, use the software as-is, and see what you accomplish.  Then try the more complex methods.

2 Likes

Yes, the robot should do all the calculations and computer vision.
Well, I am using the venv to keep the code clean and seperate from future projekts or files. The question is if switching to GoPiGo OS would help me in the long run or if I could make it work with some tweaks

3 Likes

The best way to keep projects separate is to maintain separate media - one SD for this project, another SD for another, and so on.

This way you avoid all the complications of running virtual environments.

In my case, I want to have my cake and eat it too - separate environments, but access to a central project file store - so what I did was to take a large, (500 gb), external SSD, (large capacity, small size), and make it into a multiple-boot device with more than one operating system.

Though that might be useful in the long run, I would suggest you start with a simple setup - a high-quality 32gb SD card by SanDisk, a copy of GoPiGo O/S, and see what happens.

2 Likes

@jimrh, EVERYONE but you and I use virtual environments. It is the recommended approach to allow various configurations. Let’s say one test needs OpenCV3.x and one needs OpenCV4.x, or one needs Python 3.2 and another 3.5 or better.

RobertLucian used to work with the venv folk to get setup. It works, we just don’t know how to do it.

2 Likes

. . . and that’s the whole problem.

So, this poor sod has two options:

  1. Bang his head and try to figure this out.
    • This would be useful, but he may actually have real work to do that’s on a schedule.
  2. Bite the bullet, use the system as-is, and use different SD cards instead of virtual environments.
  • Maybe that’s not as “cool” or up-to-date as venv, but it works.

IMHO, right now he should concentrate on “it works” than getting venv to work on an operating system (buster) that may have it’s own issues.

That is, unless his project has a hard dependency on using a virtual environment - as in the project will either loose massive credit or not be acceptable without it.

If that’s the case, he may have to give the folks at support@modrobotics.com a shout.

@superbam
If you go the support e-mail route and figure out how to get those [censored!] virtual environments working, please tell us.

Even better, start your own topic thread and post a how-to!

2 Likes

My Opinion - GoPiGo OS might give you problem when updating the OS.

There is another way to create the virtual environments though - that is get the GoPiGo3 installed in the system level, then create your venv with copy system.

2 Likes

Thank you very much, you two! I appreciate both of you. Since the time is ticking for me and my degree, I have to find a solution that is as less time consuming as possible. I don’t really know if the venv is really necessary, but since it’s the “right” way I would consider keeping it. I need to find a fast way to get the gopigo going.

@cyclicalobsessive you mentioned a way to get the venv running a different way? I have to say though, that I had to fix a missing module error. I needed to remove libs from outside the venv and install it back inside the venv. So if I remove the venv and start it back up. This error would need fixing again, I guess

3 Likes

I recommend either

  1. Stock 3.0.1 GoPiGo OS with @jimrh guidance on how to allow updating

or

  1. install GoPiGo3 software over the Legacy Buster based PiOS (“Legacy PiOS” available under other in the latest official Pi Imager application) the follow my how to with tests for proper install

Setup GoPiGo3 Over Legacy (2021-12-02) PiOS
(with VNC setup for Mac OS Remote Desktop)
(and installation tests)

Setup_GoPiGo3_Over_PiOS_Legacy.txt (6.3 KB)

 

Note: The gopigo3 OS route will have a version of TFlite on it and is the “official” OS now for GoPiGo, but it may have a problem when a user updates the OS…

It also has the advantage that @jimrh is running it so might be able to reproduce any problems you encounter.

2 Likes

Edited:
Never mind. yes I can repro this. Something changed with Buster and Python 3.7.

Honestly, in the Pi community, not too many people use virtual environments as it’s so easy to just swap SD cards - which become your venv in a sense. It would be completely different with a full-fledged computer though. I use venv all the time on my laptop, but never on a Pi.

Anyway, I’ll take a look at this but I can’t give you a time or date as I’m totally swamped at the moment.

3 Likes

That shouldn’t be an issue with GoPiGo OS, as it’s now possible to upgrade those libraries.

3 Likes

What I just can’t get my head around is the fact, that my files aren’t up to date. But I can’t get them to be updated :thinking:. I remember the first time I used this command: “sudo curl -kL dexterindustries.com/update_gopigo3 | bash” I used it in my home directory and not in my venv… Maybe this is the reason why I can’t update them in my venv…

2 Likes