PIB - 20161229: Cygwin - Python3 - Matplotlib
Cygwin ¤Ë¸ø¼° package ¤¬¤Ê¤«¤Ã¤¿¤Î¤Ç pip ·Ðͳ¤Ç install ¤ò»î¤ß¤¿¡£
¤Þ¤º¡¢python3 ¤ò install ¤·¤¿¡£
$ apt-cyg install python3
...
$ python3 --version
Python 3.4.5
pip ¤Ï¸ø¼° package ²½¤µ¤ì¤Æ¤Ê¤¤¤Î¤À¤¬¡¢°Ê²¼¤Î Wikipedia ¤Îµ­»ö¤Ë¤è¤ì¤Ð Python 3.4 °Ê¹ß¤Ç¤Ï¥Ç¥Õ¥©¥ë¥È¤ÇÉÕ°¤·¤Æ¤¤¤ë¤é¤·¤¤¡£
  • Wikipedia / Pip
¾åµ­¤ÎÄ̤ꡢËÜÆü 2016-12-29 ¸½ºß¤Î Cygwin ¸ø¼° package ¤Ï°Ê²¼¤ÎÄ̤ê 3.4.5 ¤Ê¤ó¤À¤±¤É¡¢pip ¤ÏÆ°ºî¤·¤Ê¤¤¡£
¸¡º÷¤·¤Æ¤ß¤ë¤È°Ê²¼¤Î blog ¤¬¸«¤Ä¤«¤Ã¤¿¡£ ¤É¤¦¤â -m ¥ª¥×¥·¥ç¥ó¤Ç library module ¤È¤·¤ÆÉÕ°¤·¤Æ¤¤¤ë ensurepip ¤ò¥¹¥¯¥ê¥×¥È¤È¤·¤Æ¼Â¹Ô¤·¤Æ¤ä¤ì¤ÐÎɤ¤¤é¤·¤¤¡£
»È¤¤Êý¤Ï°Ê²¼¤ÎÄ̤ꡣ
$ python3 -m ensurepip --help
usage: python -m ensurepip [-h] [--version] [-v] [-U] [--user] [--root ROOT]
                           [--altinstall] [--default-pip]

optional arguments:
  -h, --help     show this help message and exit
  --version      Show the version of pip that is bundled with this Python.
  -v, --verbose  Give more output. Option is additive, and can be used up to 3
                 times.
  -U, --upgrade  Upgrade pip and dependencies, even if already installed.
  --user         Install using the user scheme.
  --root ROOT    Install everything relative to this alternate root directory.
  --altinstall   Make an alternate install, installing only the X.Y
                 versionedscripts (Default: pipX, pipX.Y, easy_install-X.Y)
  --default-pip  Make a default pip install, installing the unqualified pip
                 and easy_install in addition to the versioned scripts
$ python3 -m ensurepip
Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-8.1.1 setuptools-20.10.1
¸«¤Æ¤ÎÄ̤ê setuptools ¤È pip ¤¬Æ³Æþ¤µ¤ì¤¿¤Î¤À¤¬¡¢¤³¤ì¤ÏÉÕ°¤È¤Ï¸À¤ï¤Ê¤¤µ¤¤¬¤¹¤ë¤Î¤À¤¬¡©¡©¡©

³¤¤¤Æ¡¢ËÜÂê¤Î matplotlib ¤Î install
$ pip3 install matplotlib
Collecting matplotlib
  Using cached matplotlib-1.5.3.tar.gz
    Complete output from command python setup.py egg_info:
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.3]
                    python: yes [3.4.5 (default, Oct 10 2016, 14:41:48)  [GCC
                            5.4.0]]
                  platform: yes [cygwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                      pytz: yes [pytz was not found. pip will attempt to install
                            it after matplotlib.]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: no  [pkg-config information for 'libpng' could not
                            be found.]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]
            toolkits_tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: no  [PySide not found; PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pseyx_0h/matplotlib/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
required packages ¤Ç¤¢¤ë freetype, png ¤¬¤Ê¤¤¤Î¤Ç build ½ÐÍè¤Ê¤¤¤È¸À¤ï¤ì¤ë¡£
¤³¤ì¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤Æ²ò·è¤·¤Æ¤ª¤¤¤¿¡£
$ apt-cyg install libfreetype-devel libpng-devel python3-devel

¤Þ¤¿¡¢¾åµ­¤Î blog ¤ÇÊó¹ð¤µ¤ì¤Æ¤¤¤ë¤Î¤ÈƱÍͤǡ¢ensurepip ¤Ç install ¤µ¤ì¤¿ pip ¤¬ºÇ¿·ÈǤ¸¤ã¤Ê¤¤¤Î¤Ç¡¢upgrade ¤ò¹Íθ¤¹¤Ù¤­¤È·Ù¹ð¤¬½Ð¤ë¡£
ensurepip ¤Ë¤Ï -U ¥ª¥×¥·¥ç¥ó¤¬¤¢¤ë¤Î¤À¤¬¡¢¤É¤¦¤â 8.1.1 ¤ò̾»Ø¤·¤Æ¤¤¤ë¤é¤·¤¯¡¢ºÇ¿·ÈÇ¤Ë upgrade ¤Ï¤µ¤ì¤Ê¤¤¤è¤¦¤À¡£
pip ¤Ëɽ¼¨¤µ¤ì¤¿»Ø¼¨¤Ë½¾¤¤¡¢°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ì¤Ð pip ¤ò upgrade ½ÐÍ褿¡£
$ pip3 install --upgrade pip
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Uninstalling pip-8.1.1:
      Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1

build ¤Ë¤ÏÅöÁ³ gcc ¤¬É¬Íפǡ¢Æþ¤Ã¤Æ¤Ê¤¤¾ì¹ç¤Ï°Ê²¼¤Î¤è¤¦¤Ë¥¨¥é¡¼¤¬½Ð¤ë¡£
$ pip3 install matplotlib
...
      File "numpy/core/setup.py", line 665, in get_mathlib_info
    RuntimeError: Broken toolchain: cannot link a simple C program
    sh: gcc: コマンドがèüü‹ã¤ã‹ã‚Šã¾ã›ã‚“

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ha3xej_j/matplotlib/
ƱÍÍ¤Ë python3-devel ¤âɬÍפǤ¢¤ê¡¢Æþ¤Ã¤Æ¤Ê¤¤¾ì¹ç¤Ï°Ê²¼¤Î¤è¤¦¤Ë¥¨¥é¡¼¤¬½Ð¤ë¡£
$ pip3 install matplotlib
...
      File "numpy/core/setup.py", line 275, in check_types
        zip_safe=False,
    SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
    _configtest.c:1:20: 臡­å‘½çš„ã‚¡¯ãƒ©ãƒ¼: Python.h: No such file or directory
    コンパイルを停歡ñしました。

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ha3xej_j/matplotlib/
°Ê¾å¤Î²ò·è¤Ï
$ apt-cyg install gcc-core python3-devel
¹¹¤Ë¡¢
$ pip3 install matplotlib
...
    numpy/core/src/multiarray/numpyos.c:18:21: 臡­å‘½çš„ã‚¡¯ãƒ©ãƒ¼: xlocale.h: No such file or directory
    コンパイルを停歡ñしました。

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-e03214gb/matplotlib/
¤È¤Ê¤ê¡¢¤³¤ì¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ì¤Ð¸«¤Ä¤«¤ë¡£
$ cygcheck -p /xlocale.h
Found 4 matches for /xlocale.h
libwx_gtk2u3.0-devel-3.0.2.0-1 - libwx_gtk2u3.0-devel: wxWidgets C++ application framework (development) (installed binaries and support files)
libwx_gtk2u3.0-devel-3.0.2.0-2 - libwx_gtk2u3.0-devel: wxWidgets C++ application framework (development) (installed binaries and support files)
mingw64-i686-wxWidgets3.0-3.0.2.0-3 - mingw64-i686-wxWidgets3.0: wxWidgets C++ application framework for Win32 toolchain (installed binaries and support files)
mingw64-x86_64-wxWidgets3.0-3.0.2.0-3 - mingw64-x86_64-wxWidgets3.0: wxWidgets C++ application framework for Win64 toolchain (installed binaries and support files)
¤³¤ì¤Ï wxWidget ¼þ¤ê¤Î devel ¤¬¤´¤Ã¤½¤êÆþ¤ë¤Î¤Ç¤«¤Ê¤ê°Í¸´Ø·¸¤¬Â¿¤¯ install ¤Ë 15 ʬ¶á¤¯Íפ·¤¿¡£
$ apt-cyg install libwx_gtk2u3.0-devel
¤È¤³¤í¤¬¡¢/usr/include/wx-3.0/wx/xlocale.h ¤Ë¤Ï INCLUDE ¥Ñ¥¹¤¬Ä̤é¤Ê¤¤¤é¤·¤¯¡¢¾åµ­¤Î¥¨¥é¡¼¤Ï²ò·è¤µ¤ì¤Ê¤¤¡£

¤è¤¯¸«¤ë¤È numpy ¤Î build ¤Çíµ¤¤¤Æ¤¤¤ë¤ß¤¿¤¤¤À¡£
numpy ¤Ï required packages ¤À¤±¤É pip ¤¬¼«Æ°¤ÇÆþ¤ì¤ë¤ß¤¿¤¤¤À¤«¤é¤Þ¤«¤»¤È¤³¤¦¤È»×¤Ã¤¿¤ó¤À¤±¤É¡¢ÊѤʽê¤Çíµ¤¤¤Æ¤ë¡£
¤È¸À¤¦»ö¤Ç¡¢Cygwin ¸ø¼° package ¤È¤·¤Æ python3-numpy ¤¬ÍÑ°Õ¤µ¤ì¤Æ¤ë¤Î¤Ç¤³¤Ã¤Á¤ò»È¤Ã¤Æ¤ß¤ë¡£
¤½¤Î°Í¸´Ø·¸¤Ç python3-setuptools ¤âÍÑ°Õ¤µ¤ì¤Æ¤¤¤ë¤ó¤À¤±¤É Cygwin ¸ø¼° package ¤Î python3-setuptools ¤Ï 15.2 ¤Ê¤Î¤Ç ensurepip ¤ÇÆþ¤Ã¤¿ 20.10.1 ¤ÈÈæ¤Ù¤ë¤È¼ã´³¸Å¤¤¤Î¤À¤¬¡¢°ìȯ¤ÇºÇ¿·ÈÇ pip ¤ÏÆþ¤ë¤·¡¢Æä˷ٹð¤â½Ð¤Ê¤¤¤Î¤Ç¡¢¤³¤Á¤é¤ò»È¤Ã¤¿Êý¤¬»þû¤Ç install ¤Ë¤Ê¤ë¤À¤í¤¦¡£
$ apt-cyg install python3-numpy
¤¹¤ë¤Èº£Å٤ϰʲ¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
$ pip3 install matplotlib
...
    running build_ext
    building 'matplotlib.ft2font' extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-md4ox6eo/matplotlib/setup.py", line 277, in <module>
        **extra_args
      File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.4/site-packages/setuptools/command/install.py", lin                                     e 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.4/distutils/command/install.py", line 539, in run
        self.run_command('build')
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.4/distutils/command/build.py", line 126, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.4/site-packages/setuptools/command/build_ext.py", l                                     ine 50, in run
        _build_ext.run(self)
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 448, in bui                                     ld_extensions
        self.build_extension(ext)
      File "/usr/lib/python3.4/site-packages/setuptools/command/build_ext.py", l                                     ine 183, in build_extension
        _build_ext.build_extension(self, ext)
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 500, in bui                                     ld_extension
        include_dirs=ext.include_dirs,
      File "/tmp/pip-build-md4ox6eo/matplotlib/setupext.py", line 793, in __get_                                     _
        result = obj._hooks[self._name]() + result
      File "/tmp/pip-build-md4ox6eo/matplotlib/setupext.py", line 813, in includ                                     e_dirs_hook
        import numpy
      File "/usr/lib/python3.4/site-packages/numpy/__init__.py", line 170, in <m                                     odule>
        from . import add_newdocs
      File "/usr/lib/python3.4/site-packages/numpy/add_newdocs.py", line 13, in                                      <module>
        from numpy.lib import add_newdoc
      File "/usr/lib/python3.4/site-packages/numpy/lib/__init__.py", line 17, in                                      <module>
        from . import scimath as emath
    ImportError: cannot import name 'scimath'

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-                                     build-md4ox6eo/matplotlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);                                     code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec                                     '))" install --record /tmp/pip-4g8lb6_c-record/install-record.txt --single-versi                                     on-externally-managed --compile" failed with error code 1 in /tmp/pip-build-md4o                                     x6eo/matplotlib/

ºÇ¸å¤Î¤Ï REQUIRED DEPENDENCIES AND EXTENSIONS ¤Ë¤Ïɽ¼¨¤Î¤Ê¤«¤Ã¤¿ scimath ¤Ë°Í¸¤·¤Æ¤¤¤Æ¡¢íµ¤¤¤Æ¤¤¤ë¤è¤¦¤Ë¸«¤¨¤ë¡£
¤·¤«¤·¤³¤ì¤Ï¡¢cygwin ¸ø¼° package ¸ºß¤·¤Ê¤¤¡£
»ÅÊý¤Ê¤¤¤Î¤Ç pip ¤ÇÆþ¤ì¤Æ¤ß¤ë¤È°Ê²¼¤Î¤è¤¦¤Ëíµ¤¯¡£
$ pip3 install scimath
Collecting scimath
  Downloading scimath-4.1.2.tar.gz (84kB)
    100% |&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;&#9608;| 92kB 581kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-t2tygx61/scimath/setup.py", line 9, in <module>
        import numpy.distutils.core
      File "/usr/lib/python3.4/site-packages/numpy/__init__.py", line 170, in <module>
        from . import add_newdocs
      File "/usr/lib/python3.4/site-packages/numpy/add_newdocs.py", line 13, in <module>
        from numpy.lib import add_newdoc
      File "/usr/lib/python3.4/site-packages/numpy/lib/__init__.py", line 18, in <module>
        from .polynomial import *
      File "/usr/lib/python3.4/site-packages/numpy/lib/polynomial.py", line 19, in <module>
        from numpy.linalg import eigvals, lstsq, inv
      File "/usr/lib/python3.4/site-packages/numpy/linalg/__init__.py", line 51, in <module>
        from .linalg import *
      File "/usr/lib/python3.4/site-packages/numpy/linalg/linalg.py", line 29, in <module>
        from numpy.linalg import lapack_lite, _umath_linalg
    ImportError: No such file or directory

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-t2tygx61/scimath/
lapack_lite ¤Çíµ¤¤¤Æ¤¤¤ë¤è¤¦¤Ë¸«¤¨¤ë¤±¤É¡¢¤Ê¤ó¤À¤³¤ì¡ª¡©
¥°¥°¤Ã¤Æ¤ß¤ë¤È°Ê²¼¤Î¥Ú¡¼¥¸¤¬¸«¤Ä¤«¤Ã¤¿¡£ ¤É¤¦¤â liblapack-0.dll ¤Ë PATH ¤¬Ä̤äƤʤ¤¤ó¤À¤Ã¤Æ¡£
python3-numpy ¤Î°Í¸´Ø·¸¤ÇÆþ¤Ã¤¿ liblapack0 ÇÁ¤¤¤Æ¸«¤Æ¤ß¤¿¤é¡¢/etc/profile.d/lapack0.sh ¤Ê¤ó¤Æ¤Î¤¬Æþ¤Ã¤Æ¤Æ¡¢Íפ¹¤ë¤Ë¡¢shell ºÆµ¯Æ°¤·¤Æ profile.d ½èÍý¤·¤Ê¤¤¤È /usr/lib/lapack ¤Ë PATH ¤¬Ä̤é¤ó¤È¤¤¤¦»ö¤é¤·¤¤¡£
¤È¤ê¤¢¤¨¤º¡¢°Ê²¼¤Î¤è¤¦¤Ë¤·¤ÆÆɤ߹þ¤ß¡£
source /etc/profile.d/lapack0.sh
¤½¤¦¤¹¤ë¤È¤³¤¦¤Ê¤Ã¤¿
$ pip3 install scimath
Collecting scimath
  Using cached scimath-4.1.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-z8xpui7l/scimath/setup.py", line 13, in <module>
        execfile(join('scimath', '__init__.py'), info)
    NameError: name 'execfile' is not defined

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-z8xpui7l/scimath/
¤³¤ì¤Ï°Ê²¼¤«¤Ê¡© Python3 ¤Ç¤Ï execfile() ¤¸¤ã¤Ê¤¯¤Æ exec() ¤Ë¤Ê¤Ã¤¿¤Ã¤Æ¡¢¤É¤¦¤·¤í¤È¡ª¡©

³¤­