I have an ipython notebook which starts with
import sklearn
When I run it, I get :
ImportError: No module named sklearn
I was able to fix this error on Ubuntu by adding a cell to the top of the notebook appending the module directory to the path:
import sys
sys.path.append('/usr/lib/python2.7/dist-packages')
The path to add can be found when running pip install <something>
, (such as numpy) and it tells you where each package is installed or already exists.
Is it possible that /usr/bin/python is actually a symlink?
The better solution is that you should be running your ipython notebook from a virtualenv that contains all the modules that you need.