python-sense-hat: Sense Hat can't find RTIMU after upgrade to Python 3.5.2
I recently upgraded the GNU R packages from 3.1.1 to 3.3.1. To do this, I had to add the stretch distribution to my /etc/apt/sources.list file. In the process of successfully upgrading GNU R, apt also chose to install an upgraded version of Python3. Now when I try to use the Sense Hat module with Python3, I get the following error message:
`Python 3.5.2+ (default, Sep 22 2016, 12:18:14) [GCC 6.1.1 20160802] on linux Type “copyright”, “credits” or “license()” for more information.
from sense_hat import SenseHat Traceback (most recent call last): File “<pyshell#0>”, line 1, in <module> from sense_hat import SenseHat File “/usr/lib/python3/dist-packages/sense_hat/init.py”, line 2, in <module> from .sense_hat import SenseHat, SenseHat as AstroPi File “/usr/lib/python3/dist-packages/sense_hat/sense_hat.py”, line 10, in <module> import RTIMU # custom version ImportError: No module named ‘RTIMU’ `
pip3 reports that sense-hat 2.2.0 and RTIMUlib 7.2.1 are installed. I do NOT get this error when I use Python 2.7.9.
Any ideas on what got broken during the apt-get install of r-base? It was working fine before the GNU R upgrade.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (4 by maintainers)
As it’s not very clear in that thread, I’d like to share what I did. Basically following
bennuttall
recommendation did the trick:virtualenv -p /usr/bin/python3 ~/.ve/sensorhat
source ~/.ve/sensorhat/bin/activate
git clone https://github.com/RPi-Distro/RTIMULib/ RTIMU
cd RTIMU/Linux/python
sudo apt install python3-dev
python setup.py build
python setup.py install
libopenjp2-7
:sudo apt install libopenjp2-7
sense-hat
:sudo apt install sense-hat
That should do the trick. Some code like this should work:
That’s very nice of you! I just tested successfully with:
That seem to be sufficient,
libtiff-tools
is installed as asense-hat
dependency and I didn’t needlibatlas-base-dev
at all. Hope this helps!I’m getting “PyRTIMU.h: No such file or directory” with the above suggestions.
same problem, with python3.8 on a PRi-2 in a virtual environment the pip install RTIMULib return with an error
Has anyone gotten this to work? I’m hitting this same issue when trying to dockerize sense-hat
This helped a lot, thank you so much 👍
I have uploaded a test copy of RTIMULib to PyPI in order to make this process simpler.
You can now
pip install rtimulib
in a virtualenv, and as long as you have the other requirements you stated, it works. However, I seemed to needlibatlas-base-dev
,libopenjp2-7
,libtiff-tools
andsense-hat
.Once this is confirmed and tested properly I’ll push out a new sense hat version to pypi including the dependency on rtimulib, and document the process required for using in a virtualenv.