I have an ipython notebook which starts with
import sklearn
When I run it, I get :
ImportError: No module named sklearn
indeed if I run the following snippet on the notebook, it's not showing scikit_learn:
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print installed_packages_list
However when I run the snippet from command line, scikit_learn is in the list.
I thought of a version problem (module installed for one version and not on the other one), bur both on notebook and command line, sys.version give 2.7.5
Any idea about the issue here ?
Following cel's comments:
ipython -c "import sys; print(sys.executable)"
outputs /usr/bin/python (and so does running import sys; print(sys.executable)
directly in the notebook)
Then, /usr/bin/python -m pip install scikit-learn
outputs: Requirement already satisfied (use --upgrade to upgrade): scikit-learn in /Users/MyUserName