ModuleNotFoundError: No Module named 'di_i2c' in python 3.9

Hi, I’m using the GrovePi+ with my RaspberryPi 4b on a fresh install of the latest version with Python 3.9.

I used the instructions here at: https://github.com/DexterInd/GrovePi to try and install the GrovePi library.

However in python whenever I try to “import grovepi” I’m faced with
“ModuleNotFoundError: No Module named ‘di_i2c’”.

I also tried to go into Dexter/GrovePi/Software/Python/ and ran the “python setup.py test” command which also stated that the ‘di_i2c’ module wasn’t installed.

I’ve read through some of the issues others have faced and tried their solutions but none have worked so far either.

Really unsure what the issue here is an any clarity would help!

2 Likes

By any chance are you trying to use the latest PiOS? ModRobotics posted that all the installers are broken because the latest OS removed Python2.

See:

3 Likes

Yeah I just installed it off the downloader for the RasPi.

So is the solution to just run

sudo apt install python2 -y;

before I run the curl script?

Or would it be more prudent to just flash an older version of PiOS?

I literally spent the longest time trying to fix this, you are a godsend for providing insight in like an hour of asking!

2 Likes

Since you are talking about blowing away the current image, I’d say what have you got to lose. Do a Python 2.7 install , reboot, and try running the grovepi install again to see if you are up and running.

If not, then find a buster image (Pi4 requires at least buster,) and then do the grovepi install.

It is a pain to start all over, so I hope the Python2.7 install can do the trick.

There is a “raspian for robots” buster image fully configured for grovepi onavailable also.

The latest R4R files (Old but good):

https://sourceforge.net/projects/dexter-raspbian-for-robots/files/

Direct Download of the 2019_12_12 (Experimental) RaspbianForRobots Buster (Pi4 compatible):
https://sourceforge.net/projects/dexter-raspbian-for-robots/files/2019_12_12_Raspbian_For_Robots_Buster_experimental_by_Dexter_Industries.zip/download

See Raspbian For Robots : Buster and Raspberry Pi 4 - Dexter Industries

2 Likes

I tried running the command and it tells me that python2 is already installed to the newest version. Yet the curl script doesn’t work.

I’ll try getting a buster image and if not then the raspian for robots.

I’m trying to run some servos through the PivotPi (since I couldn’t get analog working with the servo). and Also have a Humidity sensor using the i2c + a motion or weight sensor + an LED. Idk if r4r has all that since not all the sensors seem to be compatible by default.

2 Likes

Do you happen to have a source for the Buster image? I cannot seem to find anything that isn’t a bullseye image for PiOS

2 Likes

UPDATE: This is a 64-bit image - not recommended

http://downloads.raspberrypi.org/raspios_arm64/images/

You can browse back via parent dir links to find various other flavors like lite images.

3 Likes

@prancy

It is almost 2 am where I am on this side of the world, and yet I felt compelled to get out of bed, (pissing off my wife in the process), go downstairs, fire up my “main machine” and give you fair warning of what you might be getting into.

Important disclaimer:
I have not messed with the Raspbian/Raspberry Pi OS 64 bit images for months now, so things might have changed, but I’m not betting on it.

First:
The 64 bit Raspbian images are considered “experimental”, and it is my considered opinion that, (at least when I was trying to build a 64 bit raspbian image for Charlie), calling it “experimental” was being generous.  Development wireframe mockups or very early alpha was more like it.

There were many things about the images that simply didn’t do what I expected - like the file manager crashing unexpectedly, WiFi being unpredictable (even with IPv6 turned off!), etc.  More importantly, when trying to import and build the Dexter libraries within a 64 bit userland, they failed miserably.  Primarily due to the fact that there were hard dependencies that did not exist in a Raspbian 64 bit world yet, and the 32 bit versions would not work no matter how you tweaked them.

If you want to build a raspbian image into a Dexter compatible image, my best advice for you is to get the latest version of Raspbian for Robots - Buster - and work with that.

- - - - Warning! - - - -

Do not, repeat NOT, attempt to update the Raspbian for Robots image as updating the image will render it useless. That is, unless you know enough about apt and/or apt-get to hold back all the pigpio packages when you do the update.

I am currently researching this and I know that one of the issues with updating Buster to the latest revision is that the pigpio packages, particularly pigpiod, break and don’t bind properly.

I do not yet know if this is caused by the pigpio packages themselves, or if some other package is causing pigpio to break, as I am still working on it.

- - - - - - - - - - - -

If you do decide to go down the 64 bit path, please let us, (me!!), know what happens.  However, be prepared for an uphill battle.

If you want a better chance of success right off, I would go the route of a completely “virgin” (not updated) Raspbian for Robots Buster, (32 bit), and start there as that already works.

3 Likes

Thank you for the very thorough research and warnings! I just want to get something working, where I can start working on it with Python.

I actually had it working when I initially flashed using the Raspberry Pi Imager before the 8th. But flashing since then caused issues. (Since it was updated on the 8th).

Whats the difference between http://downloads.raspberrypi.org/raspios_armhf/ and ‘Index of /raspios_full_armhf’?

I want to try using that since I knew I had it somewhat working with importing the grovepi module and also the seeed grove.py module.

However if that doesn’t work, how good is R4R with me using hardware modules with the GrovePi+ that aren’t “officially” supported such as the SHT35 or PivotPi (to run some servos)?

3 Likes

The answer to both your questions is, quite honestly, I don’t know.

I have not been tracking recent Raspbian/Raspberry Pi OS images recently as I have had my own lines of research going with various versions of the Dexter/Modular Robotics software.

One thing I can mention is that most of the Dexter packages expect Python to be Python 3.7 or earlier, especially as later versions of Python 3 are not always fully backwards compatible with earlier versions.  Some utilities require Python 2.  This is why I am earnestly recommending R4R Buster as everything works out-of-the-box, just so long as you don’t update it.

Nicole, (AKA Cleoqc on these forums), is the resident Modular Robotics expert on Raspbian operating systems and Dexter software.  Right now she is up to her eyeballs in poop trying to coerce older Dexter libraries to work with Bullseye preparing for a new OS release - and it’s a significant challenge that may require significant rewrites.

This is not an insignificant challenge for her, or anyone else for that matter.

With regard to “unsupported” hardware, etc., the best I can do is to quote from the movie Blazing Saddles and say, (tongue in cheek), “Son, you’re on your own!”

Cyclicalobsessive’s answer to me when I asked something similar was “Your mission, (if you choose to accept it), is to Boldly Go Where No Robot Has Gone Before.”

In other words, like the research I did into multi-booting my robot with more than one operating system image, or @cyclicalobsessive’s and @KeithW’s research into advanced class method handling and ROS, this would be a significant piece of research that YOU can work on and contribute to everyone else.

Of course, ask questions if you get stuck.  That’s what these forums are for.  We’ll give you whatever help we can, or at the very least tell you what DIDN’T work for us.

In all seriousness, I would really like to see someone like you stick around here as the rest of us have little to zero experience with the Grove-Pi.  (I bought myself a Grove-Pi+ a couple of weeks ago at hugely inflated prices just so that SOMEONE here would - at least! - have the hardware to experiment with.)

Please do experiment.  Try what you think will work.  Let us know what does, (and doesn’t), work so we can all learn and grow.

Thanks!

3 Likes

Update:

Both the GrovePi and PivotPi are fully supported in Raspbian for Robots.

There is even sample code and examples under /home/pi/Dexter/GrovePi and/or …/PivotPi to look at.

Unsupported individual modules are still an exercise left for the student. :wink:

3 Likes

Thanks!

I’ll try to document what I can and my uses with the PivotPi and GrovePi+ and write sample code and help how I can!

2 Likes

@prancy

Important update:
I have been experimenting with both updating the GoPiGo OS 3.0.1, (which is very similar to Raspbian for Robots, Buster), and at the same time, experimenting with a Waveshare 3-color e-Paper display panel.

I updated everything except the pigpio stuff and libraries, and then did some work with the e-Paper display:

. . . . and then updated the pigpiod libraries and files and it worked!

I don’t know why yet, and I don’t recommend you mess with it, but a solution (or an explanation) is at hand.

2 Likes

SOLVED (I can’t find the option to edit my post)

I had to go to Index of /raspios_armhf/images/raspios_armhf-2021-05-28 and download the zip.

I flashed the zip OS onto my Raspberry Pi using the imager and then it was compatible with the grovepi+ again.

2 Likes

OK, glad it worked!

What’s the difference between this and what you had before that DIDN’T work?

1 Like

Initially I didn’t realize that I had the newest version of the RaspiOS (Bullseye). The newest version isn’t supported by the GrovePi library yet which caused errors while installing.

But flashing the latest buster made everything work again.

2 Likes

“Not fer’ nuthin’”, but it seems like Bullseye isn’t supported by much of anything. :wink:

  • They’ve made a complete balls-up of the camera libraries, cutting all backwards compatibility and guaranteeing that any poor sod who wrote anything that used the rpicamera libraries is screwed.

  • They’re really pushing IPv6, even though IPv6 is spotty at best, (that is, unless you live in Brazil or Japan), and it causes unending havoc.  I’m not betting on the IPv6 protocol stack being worth the powder to blow it to hell at this point - even in Buster it causes no end of trouble - and Jesus help you if you’re trying to run a 64 bit version of the Raspberry Pi operating systems.

  • (This is my personal opinion here)
    They, (the Raspberry Pi O/S people), are beginning to remind me of Canonical’s treatment of Ubuntu - where they started implementing (ahem!) “improvements” - and where these so called improvements were anything but, being extremely disruptive - without any kind of user feedback.  Of course, change is necessary, but if you’re planning on making a change that will basically invalidate a HUGE chunk of your user’s hard work, it’s best to phase it in.  Me?  I’m just about ready to try and port Mint to the Raspberry Pi!

Buster, in and of itself, (IMHO, based on my experience using it), is less than ideal.  Unfortunately, if you want to run a Pi-4, you had to use it.  Bullseye looks like it’s going to be even worse.  I hope I’m wrong, but if the attitude problems on the Raspberry Pi forums don’t change, I’m not holding my breath.

2 Likes

Supposedly they’ve decided to start naming their releases after ToyStory characters.

Maybe they should have name this one “Stinky Pete”? :wink:

2 Likes

Jessie, Stretch, and Buster were also ToyStory chars.

3 Likes