Python 3.6 grovepi.py error

Hi,

on my raspberryPi con grovePi module, I updated the python version at 3.6.5 version. Now when I run my app, I have the following error:

python3.6 jhb_app.py
Traceback (most recent call last):
File “jhb_app.py”, line 8, in
import grovepi
File “/usr/local/lib/python3.6/site-packages/grovepi-1.4.1-py3.6.egg/grovepi.py”, line 52, in
ModuleNotFoundError: No module named ‘numpy’

I have the latest version for numpy but I don’t know why I have this issue. Can you help me?

Thanks
Alessandro

2 Likes

What do you see when you type:

$ sudo pip3 show numpy


pi@Carl:~/Carl/Projects/safeDrive $ sudo pip3 show numpy
Name: numpy
Version: 1.15.1
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /usr/local/lib/python3.5/dist-packages
Requires: 
Required-by: PyWavelets, opencv-contrib-python, matplotlib, mahotas, imageio, grovepi, sense-hat, scrollphathd, microdotphat

… or nothing, then command line prompt

Hi @cyclicalobsessive

I run the command. Here what I can see:

thanks
Alessandro

1 Like

I tried to update. now I have the 1.18.5 version

But I have always the same issue:

1 Like

What happens if you use:

sudo pip3.6 install numpy

I am not good at python config issues. This is one of the times real python folks often tell me “you should use virtual environments”, but usually I have already messed up the sys environment so always whisper “next time” under my breath.

HI,

I tried but it does not work:

@alessandro.graps like I hinted at earlier - you probably should not listen to my python configuration advice:

At the bottom of that last screenshot, it says you need to update your pip (or pip3) with

pip install --upgrade pip

but most likely you will need to do this as root though so it would be:

sudo pip install --upgrade pip

Now another disclaimer - I found that Raspbian For Robots is very tightly dependent on Python versions 2.7 and 3.5. If you are trying to upgrade Raspbian For Robots Python compiler to version 3.6, you are probably headed for trouble. You should use virtual environments to run a different version of Python.

Here are my notes from investigating virtual environments:

Virtual Python Environments With Specific Python Versions

Using:

python3 -m venv  

Virtual environments are part of the Python3 package (since v3.3)

  • To create a virtual environment for a project:
$ cd my_project_folder
  • using the default python3 version and no installed site packages
$ python3 -m venv  dir_name     (common to use venv for dir_name)    or
  • or to use default python3 version and the installed site packages
$ python3 -m venv --site-packages venv-w-site-packages
  • To use the virtual env:
$ cd my_project_folder
$ source venv/bin/activate    
or 
$ source venv-w-site-packages/bin/activate
(venv) $
or
(venv-w-site-packages) $

To save the current state of the environment:

(venv) $ pip freeze > requirements.txt  

To recreate installed packages in a new venv:

(venv) $ pip install -r requirements.txt

To stop using the virtual env:

(venv) $ deactivate

!!! Be sure to add the virtual environment folder to the .gitignore list if not named venv

Hi,

thanks for your help. I followed your instructions. Now, when I run my app:
python3 jhb_helmet.py -g False -i False
I have another error:
thread: MainThread exception: module ‘grovepi’ has no attribute ‘read_interrupt_state’

I tried to update grovepi with the command below:
sudo curl -kL dexterindustries.com/update_grovepi | bash

but the error that I have is:

Post-processing (stage 2)…
Building modules…
Building module “mvn”…
Constructing wrapper function “mvnun”…
value,inform = mvnun(lower,upper,means,covar,[maxpts,abseps,releps])
Constructing wrapper function “mvnun_weighted”…
value,inform = mvnun_weighted(lower,upper,means,weights,covar,[maxpts,abseps,releps])
Constructing wrapper function “mvndst”…
error,value,inform = mvndst(lower,upper,infin,correl,[maxpts,abseps,releps])
Constructing COMMON block support for “dkblck”…
ivls
Wrote C/API module “mvn” to file “build/src.linux-armv7l-3.6/scipy/stats/mvnmodule.c”
Fortran 77 wrappers are saved to “build/src.linux-armv7l-3.6/scipy/stats/mvn-f2pywrappers.f”
warning: no previously-included files matching ‘subr.f’ found under directory ‘scipy/linalg/src/id_dist/src’
no previously-included directories found matching ‘benchmarks/env’
no previously-included directories found matching ‘benchmarks/results’
no previously-included directories found matching ‘benchmarks/html’
no previously-included directories found matching ‘benchmarks/scipy’
no previously-included directories found matching ‘scipy/special/tests/data/boost’
no previously-included directories found matching ‘scipy/special/tests/data/gsl’
no previously-included directories found matching ‘scipy/special/tests/data/local’
no previously-included directories found matching ‘doc/build’
no previously-included directories found matching ‘doc/source/generated’
warning: no previously-included files matching ‘~’ found anywhere in distribution
warning: no previously-included files matching '
.bak’ found anywhere in distribution
warning: no previously-included files matching ‘.swp’ found anywhere in distribution
warning: no previously-included files matching '
.pyo’ found anywhere in distribution
warning: no previously-included files found matching ‘LICENSES_bundled.txt’
resetting extension ‘scipy.odr.__odrpack’ language from ‘c’ to ‘f77’.

do you have any idea?

thanks
Alessandro

Sorry, no clue. As for updating your grovepi - write to support@modrobotics.com

Hi, can you assist with this problem? When I’m looking to installation module pyttsx3, I even have this error: FileNotFoundError: [Errno 2] No such report or directory: ‘/System/Library/CoreServices/SystemVersion.Plist’ The GPS code doesn’t appear to training session of the box. Are there any films demonstrating the GPS sensor for GrovePi?