Windows+Pythonにmatplotlibをインストール

諸般の都合でWindows+Pythonにmatplotlibをインストールしようとしたらコケたのでメモ。

結論: pipをアップグレードすればよろしい。

C:\>C:\Python27\Scripts\pip install matplotlib
You are using pip version 7.0.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting matplotlib
  Using cached matplotlib-1.5.3.tar.gz

(中略)

Command "python setup.py egg_info" failed with error code 1 in c:\users\2510\appdata\local\temp\pip-build-bxarh2\matplot
lib

C:\>C:\Python27\Scripts\pip list
You are using pip version 7.0.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
numpy (1.11.1)
pip (7.0.1)
setuptools (16.0)

首をかしげながらいろいろ調べた挙句、pipがちゃんと動いていない気がして良く見たら、「You are using pip version 7.0.1, however version 8.1.2 is available.」といわれている。(しかも2度も)

C:\>C:\Python27\Scripts\pip install --upgrade pip
You are using pip version 7.0.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |################################| 1.2MB 327kB/s
Installing collected packages: pip
  Found existing installation: pip 7.0.1
    Uninstalling pip-7.0.1:
      Successfully uninstalled pip-7.0.1
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip\basecommand.py", line 223, in main

  File "C:\Python27\lib\site-packages\pip\commands\install.py", line 297, in run
    # wheels, and don't try to build wheels when wheel is
  File "C:\Python27\lib\site-packages\pip\req\req_set.py", line 633, in install

  File "C:\Python27\lib\site-packages\pip\req\req_install.py", line 734, in commit_uninstall
    )
  File "C:\Python27\lib\site-packages\pip\req\req_uninstall.py", line 153, in commit
    self.file = pth_file
  File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "C:\Python27\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 89, in rmtree
    def get_prog():
  File "C:\Python27\lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Python27\lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "C:\Python27\lib\shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 101, in rmtree_errorhandler
    shutil.rmtree(dir, ignore_errors=ignore_errors,
WindowsError: [Error 5] アクセスが拒否されました。: 'c:\\users\\2510\\appdata\\local\\temp\\pip-usbfat-uninstall\\python
27\\scripts\\pip.exe'

……ちょっと、大丈夫なのこれ?と思いつつ続ける。

C:\>C:\Python27\Scripts\pip --version
pip 8.1.2 from C:\Python27\lib\site-packages (python 2.7)

OK、エラーのことは忘れよう。

C:\>C:\Python27\Scripts\pip install --upgrade pip
Requirement already up-to-date: pip in c:\python27\lib\site-packages

C:\>C:\Python27\Scripts\pip install matplotlib
Collecting matplotlib
  Downloading matplotlib-1.5.3-cp27-cp27m-win_amd64.whl (6.1MB)
    100% |################################| 6.1MB 125kB/s
Collecting python-dateutil (from matplotlib)
  Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
    100% |################################| 204kB 380kB/s
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Collecting pytz (from matplotlib)
  Downloading pytz-2016.6.1-py2.py3-none-any.whl (481kB)
    100% |################################| 481kB 469kB/s
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
  Downloading pyparsing-2.1.8-py2.py3-none-any.whl (54kB)
    100% |################################| 61kB 787kB/s
Collecting cycler (from matplotlib)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
  Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, pytz, pyparsing, cycler, matplotlib
Successfully installed cycler-0.10.0 matplotlib-1.5.3 pyparsing-2.1.8 python-dateutil-2.5.3 pytz-2016.6.1 six-1.10.0

Comments are closed.