I am trying to install scikit learn using
pip install -U scikit-learn
But it doesn't get installed. I tried to install numpy and scipy at first but I could not install those either :(
I am trying to install scikit learn using
pip install -U scikit-learn
But it doesn't get installed. I tried to install numpy and scipy at first but I could not install those either :(
If you have root access on your machine and want to install the package system-wide you can just
sudo apt install python-sklearn
If you do not want that or if you do not have root access then read on (the example is for python3; works for python2 just the same):
You need to install a virtualenv first (as non-root user) and then use pip within that virtualenv:
virtualenv -p /usr/bin/python3 /tmp/venv
Now you can either activate that venv and install:
$ . /tmp/venv/bin/activate
(venv) $ pip install -U scikit-learn
or directly call pip (with its full path):
/tmp/venv/bin/pip install -U scikit-learn
First, you may need to do:
sudo apt install python-dev
If you use the interpreter in that virtualenv (inside an activated shell or again with the complete path /tmp/venv/bin/python3 you should be able to use the scikit-learn package).
/tmp/venv/ is of course a stupid path to put the virtualenv; you'd usually have it somewhere in your /home.
Here are the docs for virtualenv (which included in the standard python distribution).