On linux I am managing Python via anaconda
. However, as there was no good support for amplpy
, I installed that via pip
.
Now, When I am in ipython, I can do
In [1]: import amplpy
In [3]: amplpy
Out[3]: <module 'amplpy' from '/home/x/anaconda3/envs/myenv3/lib/python3.6/site-packages/amplpy/__init__.py'>
and similarly if I run from bare python
. However, when I start jupyter notebook
(myenv3) x:yy$ jupyter notebook
and open a fresh python 3
sheet, I get
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-93ba964328c9> in <module>()
----> 1 import amplpy
ModuleNotFoundError: No module named 'amplpy'
sys.path
gives me
['',
'/home/x/anaconda3/lib/python36.zip',
'/home/x/anaconda3/lib/python3.6',
'/home/x/anaconda3/lib/python3.6/lib-dynload',
'/home/x/anaconda3/lib/python3.6/site-packages',
'/home/x/anaconda3/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg',
'/home/x/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg',
'/home/x/anaconda3/lib/python3.6/site-packages/IPython/extensions',
'/home/x/.ipython']
Which is the wrong folder! ipython
has /home/x/anaconda3/envs/myenv3/lib/...
as path!
What can cause such inconsistency, and how do I fix it?
Most probably, you've installed the module to a different environment than the one your jupyter
command is using (e.g. if there' no jupyter
in your "myenv3", whatever else is found on the PATH
will be used). See e.g. Keras import error Nadam for troubleshooting tips.