os: mac os yosemite
python: 2.7.6 -- 64-bit
installed: numpy,skipy,matplotlib,nose
I get the following error.
>>> from sklearn.datasets import load_iris
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sklearn.datasets
$ pip install --user --install-option="--prefix=" -U scikit-learn
Requirement already up-to-date: scikit-learn in /Library/Python/2.7/site-packages
Cleaning up...
Someone help me please!
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages or export PYTHONPATH=$PYTHONPATH:'path where your installed modules are'
to find out the path where your modules are installed, try to run pip install again and it will output the location
Ran into a similar problem recently and spent too much time googling it while the error was simple: my file was named sklearn.py It might be why your import is not working.
When installing on Ubuntu Linux you have to have to install dependencies first using apt-get, then use a pip install otherwise the normal pip install of scikit-learn won't work properly. See below:
Step 1: Make sure apt-get is updated
sudo apt-get update
Step 2: Install dependencies
sudo apt-get install build-essential python-dev python-setuptools python-numpy python-scipy libatlas-dev libatlas3gf-base
Step 3: pip install Scikit Learn
pip install --user --install-option="--prefix=" -U scikit-learn
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With