Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: could not create '/usr/local/lib/python2.7/dist-packages/sklearn': Permission denied

I'm trying to install scikit learn following by http://scikit-learn.org/stable/install.html but at the end getting this error

creating /usr/local/lib/python2.7/dist-packages/sklearn

error: could not create '/usr/local/lib/python2.7/dist-packages/sklearn': Permission denied

----------------------------------------
  Can't roll back scikit-learn; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_tauqeer/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-i5vTnt-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_tauqeer/scikit-learn
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 48: ordinal not in range(128)

I have also tried pip install scikit-learn and it shows

Requirement already satisfied (use --upgrade to upgrade): scikit-learn in /usr/lib/python2.7/dist-packages
Cleaning up...

I have also tried it by using

sudo apt-get install scikit-learn

by trying sudo I'm getting this

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package scikit-learn

like image 585
Tauqeer H. Avatar asked Feb 24 '26 20:02

Tauqeer H.


1 Answers

Make sure that you have installed dependencies. Installing from source requires you to have installed the scikit-learn runtime dependencies

You can install them using

sudo apt-get install build-essential python-dev python-setuptools \
                     python-numpy python-scipy \
                     libatlas-dev libatlas3gf-base

Then use below command to install

pip install --user --install-option="--prefix=" -u scikit-learn

Then you will not get any error.

like image 67
Usman Maqbool Avatar answered Feb 27 '26 01:02

Usman Maqbool