2

I am new to python and is using pip to download and install packages. I ran the following code on my command window and it throws an error

pip install matplotlib

And the process starts as

Collecting matplotlib
  Using cached matplotlib-1.5.3-cp27-cp27m-win32.whl
Collecting numpy>=1.6 (from matplotlib)
  Using cached numpy-1.11.2-cp27-none-win32.whl
Collecting python-dateutil (from matplotlib)
  Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Collecting cycler (from matplotlib)
  Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
  Using cached pyparsing-2.1.10-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
  Using cached pytz-2016.7-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, cycler, pyparsing, pytz, matplotlib
Exception:
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python27\lib\site-packages\pip\commands\install.py", line 317, in run
    prefix=options.prefix_path,
  File "c:\python27\lib\site-packages\pip\req\req_set.py", line 742, in install
    **kwargs
  File "c:\python27\lib\site-packages\pip\req\req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\python27\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "c:\python27\lib\site-packages\pip\wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\python27\lib\site-packages\pip\wheel.py", line 324, in clobber
    shutil.copyfile(srcfile, destfile)
  File "c:\python27\lib\shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'c:\\python27\\Lib\\site-packages\\numpy\\core\\multiarray.pyd'

And it gives these traceback errors. I'm unable to figure out what these errors are and how to solve them. Please help. It works perfectly till collecting the packages but at the time of installing it throws errors.

3
  • 1
    PIP is trying to say "Hi, I downloaded all the packages, but I can't run their installation scripts. Do I have a permission to run scripts in that folder?" Commented Oct 16, 2016 at 15:49
  • 1
    This normally happens when you already have an instance of python running it's like trying to rename a word file while it is open in word, it won't work. Close all python programs and interpreters and try again. Are you using it on a normal PC? If so I would suggest you download the Anaconda distribution of python. It has most of the packages included, matplotlib being one of them. Commented Oct 17, 2016 at 7:08
  • I guess that was the problem. I restarted cmd and downloaded the version manually by using pip download matplotlib==1.5.3 and then pip install matplotlib==1.5.3 Thanks for your help @NeillHerbst Commented Oct 18, 2016 at 8:06

2 Answers 2

2

If you're using Windows, the easiest way to install many of the numerically-oriented Python packages is to download one of wheels containing pre-compiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/, and install using pip:

pip install SomePackage-1.0-py2.py3-none-any.whl

Make sure to download the right wheel version (Python2 or Python3, 32 bit or 64 bit) for your Python installation.

Sign up to request clarification or add additional context in comments.

Comments

2

Try python -m pip install matplotlib.

or

  1. Open the cmd as administrator
  2. then python -m pip install matplotlib

4 Comments

The same error comes after python -m pip install matplotlib
What is happening exactly and what changes should I make ?
What happens is that the folders pip trying to run scripts from is in the C drive which usually require an administrator access. I edited the answer, try the second way.
I did that as soon as you said it needs permissions. Still that is not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.