IPython won’t import a module that Python imports fine

Home / Uncategorized / IPython won’t import a module that Python imports fine

Question:
I have miniconda and iPython installed on a Raspberry Pi running Raspian Jesse, July 2017. I don’t think this is a Pi issue, so I didn’t post this to that particular exchange, but maybe I’m wrong.

I’m trying to load a module called RTIMU. It loads just fine in the installed python3:$ /usr/bin/python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from pprint import pprint
>>> pprint(sys.path)
[”,
‘/usr/lib/python3.4’,
‘/usr/lib/python3.4/plat-arm-linux-gnueabihf’,
‘/usr/lib/python3.4/lib-dynload’,
‘/usr/local/lib/python3.4/dist-packages’,
‘/usr/lib/python3/dist-packages’,
‘/usr/lib/python3.4/dist-packages’]
>>> import RTIMU
>>> RTIMU

>>>
but when I try to import it from IPython, it’s not even found:$ ipython
Python 3.4.3 |Continuum Analytics, Inc.| (default, Aug 21 2015, 00:53:08)
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 6.1.0 — An enhanced Interactive Python. Type ‘?’ for help.

In [1]: import sys

In [2]: sys.path
Out[2]:
[”,
‘/miniconda3/bin’,
‘/miniconda3/lib/python34.zip’,
‘/miniconda3/lib/python3.4’,
‘/miniconda3/lib/python3.4/plat-linux’,
‘/miniconda3/lib/python3.4/lib-dynload’,
‘/miniconda3/lib/python3.4/site-packages’,
‘/miniconda3/lib/python3.4/site-packages/setuptools-18.1-py3.4.egg’,
‘/miniconda3/lib/python3.4/site-packages/IPython/extensions’,
‘/home/pi/.ipython’,
‘/usr/lib/python3.4’,
‘/usr/lib/python3.4/plat-arm-linux-gnueabihf’,
‘/usr/lib/python3.4/lib-dynload’,
‘/usr/local/lib/python3.4/dist-packages’,
‘/usr/lib/python3/dist-packages’,
‘/usr/lib/python3.4/dist-packages’]

In [3]: import RTIMU
—————————————————————————
ImportError Traceback (most recent call last)
in ()
—-> 1 import RTIMU

ImportError: No module named ‘RTIMU’

In [4]:
I’ve shown the sys.path for each attempt to illustrate that the fully python3 path is in the path to IPython. I’ve also shown the module repr, to illustrate that the module is in that path.

What’s going on here?


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *