0

I have Python 3.6 correctly installed and have been working on Eclipse. But I cannot use the libraries. Every time I import them I get an error message:

Traceback (most recent call last):
  File "C:\Users\gilbe\eclipse-workspace\python3.6\BeginnerFiles\IrisDataSet", line 1, in <module>
    from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'`

When I tried installing sklearn, numpy, and scipy, I type in the following into Windows Command Prompt:

"pip install numpy", "pip install scipy", or "pip install sklearn".

However, I get an error message every time. For example:

C:\Program Files (x86)\Python36-32\Scripts>pip install sklearn
Collecting sklearn
  Using cached https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting scikit-learn (from sklearn)
  Using cached https://files.pythonhosted.org/packages/87/b7/0e7f5c0cf765cf4e1924c068e7b2e1708c93ebffde9302a57ea8f26619e9/scikit_learn-0.19.1-cp36-cp36m-win32.whl
Installing collected packages: scikit-learn, sklearn
Exception:
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python36-32\\Lib\\site-packages\\scikit_learn-0.19.1.dist-info'
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Further, when I try to upgrade the pip command using the suggested command above, I also get an error message:

C:\Program Files (x86)\Python36-32\Scripts>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\Program Files\Inkscape\python\lib\shutil.py", line 303, in move
    os.unlink(src)
WindowsError: [Error 5] Access is denied: 'c:\\program files\\inkscape\\python\\lib\\site-packages\\pip-9.0.1.dist-info\\description.rst'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

My real question here is how do I fix these issues, and install these libraries correctly, I have spent a whole day trying to fix this in different ways, including: installing the libraries from inside Eclipse, through Window>Preferences>Interpreter>Python Interpreter>Install with pip , Uninstalling and Reinstalling Python, attempting to use the easy_install <package> command.

Please help.

g24
  • 9
  • 6
  • Did you try `pip install --user scikit-learn`? – cs95 Jun 04 '18 at 04:59
  • These are two different things. Access is denied is that you dont have administrative privileges to modify that directory. The other one about the pip is just a warning about older version. It doesnt solve the access denied error. – Vivek Kumar Jun 04 '18 at 05:15
  • Well, the problem with the pip command is that I cannot update it. I have managed to install the packages by running cmd as admin, that worked. However, when I tried updating the pip command, it says it was updated successfully but stays at the same version. – g24 Jun 04 '18 at 18:14
  • [This stackoverflow answer](https://stackoverflow.com/a/39814710/2992902) resolved my issue in Windows 10 using Powershell – Lokesh Oct 07 '20 at 14:27

1 Answers1

0

right click on the windows button on bottom left of your screen. Then go to "Windows PowerShell(Admin). There you try your pip installs. It will definitely work. I think you don't have the admin access that is why you are seeing.

PermissionError: [WinError 5] Access is denied

Just open the cmd with admin as user.Hope this helps.

Madhur Yadav
  • 635
  • 1
  • 11
  • 30