Installing SciPy, NumPy and matplotlib Under Cygwin

Today I tried installing these modules under Cygwin with pip. The whole thing took a few hours to figure out thanks to crappy bundled packages that pip fetches and lack of consistency between helps available online.

To install pip, you need to have `python3-setuptools`installed. Then using the `easy_install3 pip` command you can install pip.

After that, you need to have `liblapack-devel` and `libopenblas` installed via Cygwin’s package manager (SciPy depends on them). You also need to have `gcc-fortran`, `python-gtk2`, `tcl-tk`, `libpng`, `pkg-config` and a bunch of other stuff (that pip installer complains about) installed. The dependencies that pip complains about are straightforward (just mark them for installation in Cygwin’s installer).

Running `pip -v install numpy` and `pip -v install matplotlib` should get you those packages without much headache. The most important thing is that as of SciPy v 0.16.1, there seems to be some error in SciPy’s C files that prevents compilation and installation. I was able to get it to install using `pip -v install scipy==0.15.1`.

After installation, you may notice that you can’t plot stuff using mathplotlib’s `pyplot` module. To fix that, you need to have `XWinServer` running and should configure matplotlib to use `tkagg` backend. To do this, locate the file `matplotlibrc` and change `backend      : agg` to `backend      : tkagg`. The plots should show now!

27 comments

Skip to comment form

    • Alex on March 16, 2016 at 8:13 AM
    • Reply

    I’ve been banging my head against cygwin for the better part of the day today… I can’t seem to get matplotlib to install. This is what it’s saying:
    Removing source in /tmp/pip-build-ZCY_A8/matplotlib
    Command “/cygdrive/c/labs/virtualenvs/vistafy/bin/python2.7 -u -c “import setuptools, tokenize;__file__=’/tmp/pip-build-ZCY_A8/matplotlib/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(__file__).read().replace(‘\r\n’, ‘\n’), __file__, ‘exec’))” install –record /tmp/pip-N21S7w-record/install-record.txt –single-version-externally-managed –compile –install-headers /cygdrive/c/labs/virtualenvs/vistafy/include/site/python2.7/matplotlib” failed with error code 1 in /tmp/pip-build-ZCY_A8/matplotlib/

    Any ideas?

    1. Hey Alex,
      Can you tell me what steps you’ve taken so far?

        • Alex on March 31, 2016 at 11:12 AM
        • Reply

        Ah man I wish it would’ve notified me that you replied. I gave up for a while and used my vagrant box. I’ve been trying again today though. It has something to do with my libfreetype I’ve noticed. the problem I had before was really just something that it was throwing later. This is the problem:

        gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.i686/build=/usr/src/debug/python-2.7.8-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.8-1.i686/src/Python-2.7.8=/usr/src/debug/python-2.7.8-1 -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/home/lucky_000/.virtualenvs/vistafy/lib/python2.7/site-packages/numpy/core/include -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include -I. -I/usr/include/python2.7 -c src/ft2font.cpp -o build/temp.cygwin-1.7.35-i686-2.7/src/ft2font.o
        gcc: error: spawn: No such file or directory

        I’m not sure what file it’s looking for that it can’t find. It’s very likely that cygwin just eff’ed up and put it in the wrong place or something and I could fix with a symbolic link, but the error isn’t exactly descriptive.

    • KSH on September 20, 2016 at 9:55 AM
    • Reply

    I was happy to come across this but have not found it to be so easy. I’m attempting to set up python 2.7, however; perhaps that is a fool’s errand. Anyway, I’m bombing out trying to update numpy, I have no xlocale.h!

    Looking for this in the Cygwin distribution, I ended up installing many of the KDE packages, didn’t help.

    I’d say I’m going to keep trying but I don’t have the time. If you have any insight, I’d love to hear it.

    Best,
    KSH

      • andre on October 26, 2016 at 7:27 AM
      • Reply

      You can try: ‘pip install xlocale’

        • Colin on December 1, 2016 at 3:36 PM
        • Reply

        didn’t work for me. this link suggested just linking locale.h to xlocale.h

        https://forum.alpinelinux.org/forum/general-discussion/xlocaleh

        some similar suggestions and details here http://serverfault.com/questions/771211/docker-alpine-and-matplotlib

        I did get a successful numpy install afterwards

    • Malik Yousef on November 23, 2016 at 3:05 AM
    • Reply

    Hi Mehran

    I tried the command:
    pip -v install scipy==0.15.1

    and get this error:

    Command “/usr/bin/python2.7 -u -c “import setuptools, tokenize;__file__=’/tmp/pip-build-BZbhrN/scipy/setup.py’;f=getattr(tokenize, ‘open’, open)(__f;code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record /tmp/pip-Ia80Ko-record/install-record.txt –sversion-externally-managed –compile” failed with error code 1 in /tmp/pip-build-BZbhrN/scipy/
    Exception information:
    Traceback (most recent call last):
    File “/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py”, line 215, in main
    status = self.run(options, args)
    File “/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py”, line 342, in run
    prefix=options.prefix_path,
    File “/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py”, line 784, in install
    **kwargs
    File “/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py”, line 878, in install
    spinner=spinner,
    File “/usr/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py”, line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
    InstallationError: Command “/usr/bin/python2.7 -u -c “import setuptools, tokenize;__file__=’/tmp/pip-build-BZbhrN/scipy/setup.py’;f=getattr(tokenizen’, open)(__file__);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, __file__, ‘exec’))” install –record /tmp/pip-Ia80Ko-record/insecord.txt –single-version-externally-managed –compile” failed with error code 1 in /tmp/pip-build-BZbhrN/scipy/

      • T on December 24, 2016 at 3:16 PM
      • Reply

      Same here.

  1. I keep getting this:

    “`
    Traceback (most recent call last):
    File “”, line 1, in
    File “/tmp/pip-build-AIAy3f/scipy/setup.py”, line 249, in
    setup_package()
    File “/tmp/pip-build-AIAy3f/scipy/setup.py”, line 237, in setup_package
    from numpy.distutils.core import setup
    File “/usr/lib/python2.7/site-packages/numpy/__init__.py”, line 142, in
    from . import add_newdocs
    File “/usr/lib/python2.7/site-packages/numpy/add_newdocs.py”, line 13, in
    from numpy.lib import add_newdoc
    File “/usr/lib/python2.7/site-packages/numpy/lib/__init__.py”, line 17, in
    from . import scimath as emath
    ImportError: cannot import name scimath
    “`

    It doesn’t make any sense, scimath does exist there! This happens regardless of python version or scipy version. All other things have been installed.

    • Mala on February 16, 2017 at 6:19 AM
    • Reply

    Thank you, this saved me a lot of time!

    • Martin on May 10, 2017 at 12:58 PM
    • Reply

    Hi, thanks for the info, surely useful. However, what I was missing (and wasn’t clear from the pip log) was python3-devel module in Cygwin. If your installation is complaining about Python.h missing, that might be your issue too.
    Hope it might help others 😉

    • Craig Hollabaugh on July 4, 2017 at 6:29 PM
    • Reply

    Wow, did this posting save me a lot of time! Thank you, thank you, thank you. I’m forced to use a win7 host for something (I’ve been a desktop linux-only for about 15 years). I’m working with an analog discovery 2 kit and wanted to develop using vi on cygwin which mostly tolerable.

    Addition to your post, after you install numpy, pip exits without errors but continuing install results in a lapack error something like this

    from numpy.linalg import lapack_lite, _umath_linalg

    you need to add /usr/lib/lapack to your PATH.

    export PATH=$PATH:/usr/lib/lapack

    you have to get numpy running correctly for matplotlib install to happen, plus a bunch of other cygwin installs as mentioned here. Yes, you cygwin setup install a bunch of stuff, including g++, c compiler, fortran stuff, gtk stuff, etc etc etc. Here a cygcheck -c dump, sorry so long.

    After all this, I ran the AD2 AnalogIn_Acquisition.py script and a plot showed up in x, yay!!!

    Good luck fellow lazy Linux programmers like me!
    Craig

    Cygwin Package Information
    Package                                 Version                      Status
    _autorebase                             001005-1                     OK
    adwaita-icon-theme                      3.22.0-1                     OK
    adwaita-themes                          3.22.3-1                     OK
    alternatives                            1.3.30c-10                   OK
    base-cygwin                             3.8-1                        OK
    base-files                              4.2-4                        OK
    bash                                    4.4.12-3                     OK
    binutils                                2.25-4                       OK
    bzip2                                   1.0.6-3                      OK
    ca-certificates                         2.14-1                       OK
    compositeproto                          0.4.2-1                      OK
    coreutils                               8.26-2                       OK
    csih                                    0.9.9-1                      OK
    cygrunsrv                               1.62-1                       OK
    cygutils                                1.4.16-2                     OK
    cygwin                                  2.8.1-1                      OK
    cygwin-devel                            2.8.1-1                      OK
    damageproto                             1.2.1-1                      OK
    dash                                    0.5.9.1-1                    OK
    dbus                                    1.10.18-1                    OK
    dbus-x11                                1.10.18-1                    OK
    dejavu-fonts                            2.37-1                       OK
    desktop-file-utils                      0.23-1                       OK
    diffutils                               3.5-2                        OK
    dri-drivers                             17.1.3-1                     OK
    editrights                              1.03-1                       OK
    file                                    5.30-1                       OK
    findutils                               4.6.0-1                      OK
    fixesproto                              5.0-1                        OK
    gamin                                   0.1.10-15                    OK
    gawk                                    4.1.4-3                      OK
    gcc-core                                5.4.0-1                      OK
    gcc-fortran                             5.4.0-1                      OK
    gcc-g++                                 5.4.0-1                      OK
    gdk-pixbuf2.0-svg                       2.40.17-1                    OK
    getent                                  2.18.90-4                    OK
    girepository-Atk1.0                     2.22.0-1                     OK
    girepository-cairo1.0                   1.50.0-1                     OK
    girepository-GdkPixbuf2.0               2.36.6-2                     OK
    girepository-GLib2.0                    1.50.0-1                     OK
    girepository-HarfBuzz0.0                1.3.4-1                      OK
    girepository-Pango1.0                   1.40.6-1                     OK
    girepository-x11                        1.50.0-1                     OK
    gnome-menus                             3.13.3-3                     OK
    grep                                    3.0-2                        OK
    groff                                   1.22.3-1                     OK
    gsettings-desktop-schemas               3.22.0-1                     OK
    gtk-update-icon-cache                   3.22.15-1                    OK
    gtk2.0-engines-pixmap                   2.24.31-1                    OK
    gzip                                    1.8-1                        OK
    hicolor-icon-theme                      0.15-1                       OK
    hostname                                3.13-1                       OK
    info                                    6.4-1                        OK
    inputproto                              2.3.1-1                      OK
    ipc-utils                               1.0-2                        OK
    kbproto                                 1.0.7-1                      OK
    less                                    487-1                        OK
    libargp                                 20110921-3                   OK
    libatk1.0-devel                         2.22.0-1                     OK
    libatk1.0_0                             2.22.0-1                     OK
    libatomic1                              5.4.0-1                      OK
    libattr1                                2.4.46-1                     OK
    libblkid1                               2.25.2-2                     OK
    libbz2-devel                            1.0.6-3                      OK
    libbz2_1                                1.0.6-3                      OK
    libcairo-devel                          1.14.8-1                     OK
    libcairo2                               1.14.8-1                     OK
    libcom_err2                             1.42.12-2                    OK
    libcroco0.6_3                           0.6.12-1                     OK
    libcrypt0                               1.4-1                        OK
    libdatrie1                              0.2.8-1                      OK
    libdb5.3                                5.3.28-1                     OK
    libdbus1_3                              1.10.18-1                    OK
    libedit0                                20130712-1                   OK
    libEGL-devel                            17.1.3-1                     OK
    libEGL1                                 17.1.3-1                     OK
    libexpat-devel                          2.2.1-0                      OK
    libexpat1                               2.2.1-0                      OK
    libfam0                                 0.1.10-15                    OK
    libffi-devel                            3.2.1-2                      OK
    libffi6                                 3.2.1-2                      OK
    libfontconfig-common                    2.12.1-1                     OK
    libfontconfig-devel                     2.12.1-1                     OK
    libfontconfig1                          2.12.1-1                     OK
    libfontenc1                             1.1.3-1                      OK
    libfreetype-devel                       2.6.5-1                      OK
    libfreetype6                            2.6.5-1                      OK
    libgcc1                                 5.4.0-1                      OK
    libgcrypt20                             1.7.6-1                      OK
    libgdbm4                                1.12-1                       OK
    libgdk_pixbuf2.0-devel                  2.36.6-2                     OK
    libgdk_pixbuf2.0_0                      2.36.6-2                     OK
    libgfortran3                            5.4.0-1                      OK
    libGL-devel                             17.1.3-1                     OK
    libGL1                                  17.1.3-1                     OK
    libglade2.0_0                           2.6.4-2                      OK
    libglapi0                               17.1.3-1                     OK
    libglib2.0-devel                        2.50.3-1                     OK
    libglib2.0_0                            2.50.3-1                     OK
    libgmp10                                6.1.2-1                      OK
    libgnome-menu3_0                        3.13.3-3                     OK
    libgomp1                                5.4.0-1                      OK
    libgpg-error0                           1.27-1                       OK
    libgraphite2-devel                      1.3.8-1                      OK
    libgraphite2_3                          1.3.8-1                      OK
    libgssapi_krb5_2                        1.14.4-1                     OK
    libgtk2.0-devel                         2.24.31-1                    OK
    libgtk2.0_0                             2.24.31-1                    OK
    libharfbuzz-devel                       1.3.4-1                      OK
    libharfbuzz-gobject0                    1.3.4-1                      OK
    libharfbuzz0                            1.3.4-1                      OK
    libICE6                                 1.0.9-1                      OK
    libiconv                                1.14-3                       OK
    libiconv2                               1.14-3                       OK
    libintl-devel                           0.19.8.1-2                   OK
    libintl8                                0.19.8.1-2                   OK
    libisl13                                0.14.1-1                     OK
    libjasper1                              1.900.22-1                   OK
    libjasper4                              2.0.12-1                     OK
    libjbig2                                2.0-14                       OK
    libjpeg8                                1.5.0-1                      OK
    libk5crypto3                            1.14.4-1                     OK
    libkrb5_3                               1.14.4-1                     OK
    libkrb5support0                         1.14.4-1                     OK
    liblapack-devel                         3.7.0-1                      OK
    liblapack0                              3.7.0-1                      OK
    libllvm3.9                              3.9.1-1                      OK
    libllvm4.0                              4.0.1-1                      OK
    liblzma5                                5.2.3-1                      OK
    liblzo2_2                               2.08-1                       OK
    libmcpp0                                2.7.2-2                      OK
    libmpc3                                 1.0.3-1                      OK
    libmpfr4                                3.1.5-1p2                    OK
    libncursesw10                           6.0-11.20170617              OK
    libopenblas                             0.2.19-1                     OK
    libopenssl100                           1.0.2k-1                     OK
    libp11-kit0                             0.23.5-1                     OK
    libpango1.0-devel                       1.40.6-1                     OK
    libpango1.0_0                           1.40.6-1                     OK
    libpcre-devel                           8.40-3                       OK
    libpcre1                                8.40-3                       OK
    libpcre16_0                             8.40-3                       OK
    libpcre32_0                             8.40-3                       OK
    libpcrecpp0                             8.40-3                       OK
    libpcreposix0                           8.40-3                       OK
    libpipeline1                            1.4.0-1                      OK
    libpixman1-devel                        0.34.0-1                     OK
    libpixman1_0                            0.34.0-1                     OK
    libpng-devel                            1.6.28-1                     OK
    libpng-tools                            1.6.28-1                     OK
    libpng16                                1.6.28-1                     OK
    libpng16-devel                          1.6.28-1                     OK
    libpopt-common                          1.16-2                       OK
    libpopt0                                1.16-2                       OK
    libquadmath0                            5.4.0-1                      OK
    libreadline7                            7.0.3-3                      OK
    librsvg2_2                              2.40.17-1                    OK
    libsigsegv2                             2.10-2                       OK
    libSM6                                  1.2.2-1                      OK
    libsmartcols1                           2.25.2-2                     OK
    libsqlite3_0                            3.18.0-1                     OK
    libssp0                                 5.4.0-1                      OK
    libstdc++6                              5.4.0-1                      OK
    libtasn1_6                              4.12-1                       OK
    libthai0                                0.1.26-1                     OK
    libtiff6                                4.0.7-1                      OK
    libtxc_dxtn                             1.0-1.20151227gitf6ec862     OK
    libuuid-devel                           2.25.2-2                     OK
    libuuid1                                2.25.2-2                     OK
    libvtv0                                 5.4.0-1                      OK
    libX11-devel                            1.6.5-1                      OK
    libX11-xcb-devel                        1.6.5-1                      OK
    libX11-xcb1                             1.6.5-1                      OK
    libX11_6                                1.6.5-1                      OK
    libXau-devel                            1.0.8-1                      OK
    libXau6                                 1.0.8-1                      OK
    libXaw7                                 1.0.13-1                     OK
    libxcb-composite0                       1.12-1                       OK
    libxcb-devel                            1.12-1                       OK
    libxcb-ewmh2                            0.4.1-1                      OK
    libxcb-glx-devel                        1.12-1                       OK
    libxcb-glx0                             1.12-1                       OK
    libxcb-icccm4                           0.4.1-1                      OK
    libxcb-image0                           0.3.9-1                      OK
    libxcb-render-devel                     1.12-1                       OK
    libxcb-render0                          1.12-1                       OK
    libxcb-shm-devel                        1.12-1                       OK
    libxcb-shm0                             1.12-1                       OK
    libxcb-util1                            0.3.9-1                      OK
    libxcb1                                 1.12-1                       OK
    libXcomposite-devel                     0.4.3-1                      OK
    libXcomposite1                          0.4.3-1                      OK
    libXcursor-devel                        1.1.14-1                     OK
    libXcursor1                             1.1.14-1                     OK
    libXdamage-devel                        1.1.4-1                      OK
    libXdamage1                             1.1.4-1                      OK
    libXdmcp-devel                          1.1.2-1                      OK
    libXdmcp6                               1.1.2-1                      OK
    libXext-devel                           1.3.3-1                      OK
    libXext6                                1.3.3-1                      OK
    libXfixes-devel                         5.0.3-1                      OK
    libXfixes3                              5.0.3-1                      OK
    libXfont1                               1.5.2-1                      OK
    libXfont2_2                             2.0.1-1                      OK
    libXft-devel                            2.3.2-1                      OK
    libXft2                                 2.3.2-1                      OK
    libXi-devel                             1.7.9-1                      OK
    libXi6                                  1.7.9-1                      OK
    libXinerama-devel                       1.1.3-1                      OK
    libXinerama1                            1.1.3-1                      OK
    libxkbfile1                             1.0.9-1                      OK
    libxml2                                 2.9.4-2                      OK
    libXmu6                                 1.1.2-1                      OK
    libXmuu1                                1.1.2-1                      OK
    libXpm4                                 3.5.12-1                     OK
    libXrandr-devel                         1.5.1-1                      OK
    libXrandr2                              1.5.1-1                      OK
    libXrender-devel                        0.9.9-1                      OK
    libXrender1                             0.9.9-1                      OK
    libxslt                                 1.1.29-1                     OK
    libXss-devel                            1.2.2-1                      OK
    libXss1                                 1.2.2-1                      OK
    libXt6                                  1.1.5-1                      OK
    login                                   1.11-1                       OK
    luit                                    20130217-1                   OK
    man-db                                  2.7.5-2                      OK
    mcpp                                    2.7.2-2                      OK
    mingw64-x86_64-binutils                 2.25.0.1.23f238d-1           OK
    mingw64-x86_64-blas                     3.7.0-1                      OK
    mingw64-x86_64-gcc-core                 5.4.0-3                      OK
    mingw64-x86_64-gcc-fortran              5.4.0-3                      OK
    mingw64-x86_64-headers                  5.0.2-1                      OK
    mingw64-x86_64-lapack                   3.7.0-1                      OK
    mingw64-x86_64-pkg-config               0.29.1-1                     OK
    mingw64-x86_64-runtime                  5.0.2-1                      OK
    mingw64-x86_64-windows-default-manifest 6.4-1                        OK
    mingw64-x86_64-winpthreads              5.0.2-1                      OK
    mintty                                  2.7.8-0                      OK
    ncurses                                 6.0-11.20170617              OK
    openssh                                 7.5p1-1                      OK
    openssl                                 1.0.2k-1                     OK
    p11-kit                                 0.23.5-1                     OK
    p11-kit-trust                           0.23.5-1                     OK
    perl                                    5.22.3-1                     OK
    perl_autorebase                         5.22.3-1                     OK
    perl_base                               5.22.3-1                     OK
    pkg-config                              0.29.1-1                     OK
    python                                  2.7.13-1                     OK
    python-cairo                            1.12.0-1                     OK
    python-gobject                          2.28.6-5                     OK
    python-gobject-devel                    2.28.6-5                     OK
    python-gtk2.0                           2.24.0-3                     OK
    python-gtk2.0-devel                     2.24.0-3                     OK
    python-numpy                            1.11.2-1                     OK
    python-setuptools                       34.3.2-1                     OK
    python2                                 2.7.13-1                     OK
    python2-appdirs                         1.4.3-1                      OK
    python2-asn1crypto                      0.22.0-1                     OK
    python2-backports.ssl_match_hostname    3.5.0.1-1                    OK
    python2-cairo                           1.12.0-1                     OK
    python2-cffi                            1.9.1-1                      OK
    python2-chardet                         2.3.0-1                      OK
    python2-cryptography                    1.8.1-1                      OK
    python2-devel                           2.7.13-1                     OK
    python2-enum34                          1.1.6-1                      OK
    python2-idna                            2.5-1                        OK
    python2-ipaddress                       1.0.18-1                     OK
    python2-lockfile                        0.12.2-1                     OK
    python2-lxml                            3.7.3-1                      OK
    python2-numpy                           1.11.2-1                     Incomplete
    python2-openssl                         16.2.0-1                     OK
    python2-packaging                       16.8-1                       OK
    python2-pip                             9.0.1-1                      OK
    python2-ply                             3.9-1                        OK
    python2-pycparser                       2.17-1                       OK
    python2-pyparsing                       2.1.10-1                     OK
    python2-requests                        2.13.0-1                     OK
    python2-setuptools                      34.3.2-1                     OK
    python2-six                             1.10.0-1                     OK
    python2-urllib3                         1.20-1                       OK
    python2-wheel                           0.30.0a0-1                   OK
    randrproto                              1.5.0-1                      OK
    rebase                                  4.4.2-1                      OK
    renderproto                             0.11.1-1                     OK
    rsync                                   3.1.2-1                      OK
    run                                     1.3.4-2                      OK
    scrnsaverproto                          1.2.2-2                      OK
    sed                                     4.4-1                        OK
    setxkbmap                               1.3.1-1                      OK
    shared-mime-info                        1.7-1                        OK
    tar                                     1.29-1                       OK
    tcl                                     8.6.6-1                      OK
    tcl-devel                               8.6.6-1                      OK
    tcl-tk                                  8.6.6-1                      OK
    tcl-tk-devel                            8.6.6-1                      OK
    terminfo                                6.0-11.20170617              OK
    tzcode                                  2016j-1                      OK
    tzdata                                  2017b-1                      OK
    util-linux                              2.25.2-2                     OK
    vim-minimal                             8.0.0647-1                   OK
    w32api-headers                          5.0.2-1                      OK
    w32api-runtime                          5.0.2-1                      OK
    which                                   2.20-2                       OK
    windows-default-manifest                6.4-1                        OK
    xauth                                   1.0.10-1                     OK
    xcursor-themes                          1.0.4-1                      OK
    xdg-user-dirs                           0.15-1                       OK
    xextproto                               7.3.0-1                      OK
    xf86-video-dummy                        0.3.8-1                      OK
    xf86-video-nested                       0.1.0-8.20160719git          OK
    xineramaproto                           1.2.1-1                      OK
    xinit                                   1.3.4-12                     OK
    xkbcomp                                 1.4.0-1                      OK
    xkeyboard-config                        2.21-1                       OK
    xmodmap                                 1.0.9-1                      OK
    xorg-server                             1.19.2-1                     OK
    xorg-server-common                      1.19.2-1                     OK
    xorg-x11-fonts-dpi75                    7.5-3                        OK
    xorg-x11-fonts-misc                     7.5-3                        OK
    xproto                                  7.0.31-1                     OK
    xrdb                                    1.1.0-1                      OK
    xterm                                   330-1                        OK
    xwin-xdg-menu                           20170321-1                   OK
    xz                                      5.2.3-1                      OK
    zlib-devel                              1.2.11-1                     OK
    zlib0                                   1.2.11-1                     OK
    
    1. Glad this helped you and thanks for sharing your experience with us!

  2. I was waiting for this kind of matter. Thank you
    very much for the place.

    • Felicia on September 10, 2017 at 4:28 PM
    • Reply

    I think it’s easier to just install Anaconda and then put the path to the python binaries in your ~/.bash_profile. That’s what I’ve done for Java, R, and Go and it seems preferable to dealing with Cygwin’s crudginess.

    Nonetheless, thanks for publishing this.

    1. Glad you found the post useful.

    • Denisa Borges on December 8, 2017 at 10:33 AM
    • Reply

    This post is the answer to a prayer, thank yoouuuu!

    cygwin, jupyter notebook, scipy …

    • Kathy on December 19, 2017 at 3:24 PM
    • Reply

    Thank you! I have been combing the Internet for information on how to successfully install scipy on a Windows computer and cygwin. Your info about the Cygwin packages that were dependencies did the trick! After I installed, through the cygwin installer, liblapack-devel, libopenblas, gcc-fortran, python-gtk2, tcl-tk, libpng, and pkg-config (I already had this one), I was able to install scipy:
    pip install scipy
    with no problem. Thanks again!

    1. Happy to hear it helped you!

    • Tasos on August 22, 2018 at 4:37 AM
    • Reply

    Hello. Thanks for the help. I could not install scipy and matplotlib. Python devel package solved my problem. I don’t know how to change matplotlibrc backend. What exactly is backend? I am new to this stuff so could you explain this to me? I don’t know how to do it. What do you mean by saying ‘you need to have xwin server running’ ? I installed xwin server packages with cygwin install.

    • Lew Gramer on September 10, 2018 at 5:46 PM
    • Reply

    Hi, I have been trying to install a more recent version of numpy (1.15) in my virtual environment, than the one currently available as a package from cygwin setup (1.11.2). However, I continue to encounter a raft of build errors. I have reviewed your cygcheck output above, ignoring versions as it is somewhat out of date. With the exception of a few “proto” packages, I seem to now have the same packages as you show above (plus a few unique to my Cygwin install). I attempt to do a “pip install numpy==1.15.0” in a python3 venv, and still encounter errors like the following (this is just a sample of several pages worth…)

    blas_opt_info:
    blas_mkl_info:
    customize UnixCCompiler
    libraries mkl_rt not found in [‘/home/gramer/sandbox3/lib’, ‘/usr/local/lib’, ‘/usr/lib’, ‘/usr/lib/’]
    NOT AVAILABLE

    gcc /tmp/tmpi7p40tvh/tmp/tmpi7p40tvh/source.o -L/usr/lib -lcblas -o /tmp/tmpi7p40tvh/a.out.exe
    /bin/ld: cannot find -lcblas
    collect2: error: ld returned 1 exit status

    I have verified that there is *A* version of the blas library available, albeit I am not sure it is the right one:

    # ls /usr/lib/lapack
    cygblas-0.dll* cyglapack-0.dll*

    The older version of numpy that comes as a package does not work with several newer packages that I need to use, so… Any help appreciated!

    Lew Gramer

    • Guest on October 12, 2018 at 5:28 AM
    • Reply

    Mehran, thanks a million! As a newcomer to python I never would have been able to get my python2 scripts running without these simple instructions.

    One thing I also had to do that wasn’t mentioned was to install the cygwin package python2-devel. Perhaps this package is obvious to regular python users?? Anyway, you’ll know you need to install it if you get gcc compilation errors such as ” fatal error: Python.h: No such file or directory”.

    1. Happy to help!

    • Phil Goetz on April 1, 2020 at 9:32 PM
    • Reply

    Thank you so much!

    The bug in scipy is explained here:
    https://github.com/scipy/scipy/pull/11320

    Strangely, the fix (made Jan 5 2020) is still not merged into the master.

    • Phil Goetz on April 2, 2020 at 1:01 PM
    • Reply

    I used pip3-v install scipy==1.1 and version 1.1 compiled & installed fine in cygwin, though with about an hour of warnings. Maybe 1.3 would as well.

    • Martin on May 25, 2020 at 11:25 AM
    • Reply

    Thank you!
    pip -v install scipy==0.15.1 reports errors, but
    pip3 -v install scipy==1.1 worked for me, after I installed the cygwin packages you mentioned

    • David C Dyck on April 3, 2021 at 10:40 PM
    • Reply

    Just wanted to say thanks

    on cygwin was able to get

    $ pip -v install scipy

    Successfully installed scipy-1.6.2

    I installed python38-numpy and python38-matplotlib ( and a few other packages from cygwin setup first )

Leave a Reply to Phil Goetz Cancel reply

Your email address will not be published.