How do I install libraries for Python3 through Cygwin?

1

I'm trying to set up an environment in Windows 10 where I can program in Python 3 and utilize libraries and modules as I please. I am seemingly unable to achieve this through Cygwin.

EDIT: I have rewritten much of this question to be more relevant. From here on are better details.

Through the Cygwin installer python3, python3-devel, python3-setuptools, gcc and make is picked and installed.

I have installed(and made sure is not interfering with non-Cygwin python) pip/pip3 and am trying to install numpy. This is the error I get from running $ pip3 install numpy:

(Both $ python3 and $ easy_install-3.6 are working and isolated from "normal" python, although $ easy_install-3.6 gives the same errors as $ pip3)

$ pip3 install numpy
Collecting numpy
  Using cached numpy-1.13.1.zip
Installing collected packages: numpy
  Running setup.py install for numpy ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0v7a07po/numpy/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-gixpv_hq-record/install-record.txt --single-version-externally-managed --compile:
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)


    blas_opt_info:
    blas_mkl_info:
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    blis_info:
      libraries blis not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    /tmp/pip-build-0v7a07po/numpy/numpy/distutils/system_info.py:572: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    blas_info:
      libraries blas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    /tmp/pip-build-0v7a07po/numpy/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      self.calc_info()
    blas_src_info:
      NOT AVAILABLE

    /tmp/pip-build-0v7a07po/numpy/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      self.calc_info()
      NOT AVAILABLE

    /bin/sh: svnversion: command not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    /bin/sh: svnversion: command not found
    F2PY Version 2
    lapack_opt_info:
    lapack_mkl_info:
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_lapack_info:
      libraries openblas not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries tatlas,tatlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries tatlas,tatlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries satlas,satlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries satlas,satlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries f77blas,cblas,atlas not found in /usr/local/lib
      libraries lapack_atlas not found in /usr/local/lib
      libraries f77blas,cblas,atlas not found in /usr/lib
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in ['/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    /tmp/pip-build-0v7a07po/numpy/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    lapack_src_info:
      NOT AVAILABLE

    /tmp/pip-build-0v7a07po/numpy/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
      NOT AVAILABLE

    /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build/src.cygwin-2.8.2-x86_64-3.6
    creating build/src.cygwin-2.8.2-x86_64-3.6/numpy
    creating build/src.cygwin-2.8.2-x86_64-3.6/numpy/distutils
    building library "npymath" sources
    customize GnuFCompiler
    Could not locate executable g77
    Could not locate executable f77
    customize IntelVisualFCompiler
    Could not locate executable ifort
    Could not locate executable ifl
    customize AbsoftFCompiler
    Could not locate executable f90
    customize CompaqVisualFCompiler
    Found executable /usr/bin/DF
    customize IntelItaniumVisualFCompiler
    Could not locate executable efl
    customize Gnu95FCompiler
    Could not locate executable gfortran
    Could not locate executable f95
    customize G95FCompiler
    Could not locate executable g95
    don't know how to compile Fortran code on platform 'posix'
    C compiler: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python3/python3-3.6.1-1.x86_64/build=/usr/src/debug/python3-3.6.1-1 -fdebug-prefix-map=/usr/src/ports/python3/python3-3.6.1-1.x86_64/src/Python-3.6.1=/usr/src/debug/python3-3.6.1-1 -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python3/python3-3.6.1-1.x86_64/build=/usr/src/debug/python3-3.6.1-1 -fdebug-prefix-map=/usr/src/ports/python3/python3-3.6.1-1.x86_64/src/Python-3.6.1=/usr/src/debug/python3-3.6.1-1

    compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -c'
    gcc: _configtest.c
    /bin/bash: gcc: command not found
    /bin/bash: gcc: command not found
    failure.
    removing: _configtest.c _configtest.o
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-0v7a07po/numpy/setup.py", line 392, in <module>
        setup_package()
      File "/tmp/pip-build-0v7a07po/numpy/setup.py", line 384, in setup_package
        setup(**metadata)
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/install.py", line 62, in run
        r = self.setuptools_run()
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
        return distutils_install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/build.py", line 47, in run
        old_build.run(self)
      File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/build_src.py", line 148, in run
        self.build_sources()
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/build_src.py", line 159, in build_sources
        self.build_library_sources(*libname_info)
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/build_src.py", line 294, in build_library_sources
        sources = self.generate_sources(sources, (lib_name, build_info))
      File "/tmp/pip-build-0v7a07po/numpy/numpy/distutils/command/build_src.py", line 377, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 674, in get_mathlib_info
        raise RuntimeError("Broken toolchain: cannot link a simple C program")
    RuntimeError: Broken toolchain: cannot link a simple C program

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0v7a07po/numpy/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-gixpv_hq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0v7a07po/numpy/

Loke Gustafsson

Posted 2017-07-12T19:19:20.967

Reputation: 11

gcc: command not found – you need to install basic build tools in Cygwin first. Have you installed a "normal" Windows Python as well? – slhck – 2017-07-12T19:23:34.197

@slhck I believe so. I find a python3 installation at D:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32 How can I "install basic build tools"? Shouldn't dependencies install themselves? – Loke Gustafsson – 2017-07-12T19:51:03.587

Additionally, C:\Users\USERNAME\AppData\Roaming\Python\Python27\site-packages doesn't exist. – Loke Gustafsson – 2017-07-12T19:55:24.753

2You are mixing cygwin python installation with one that is windows only. D:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32 is not cygwin one. – matzeri – 2017-07-12T20:30:31.503

Either use the Windows Python or the Cygwin Python. Make sure that python and pip and easy_install etc. point to the Cygwin version if you prefer the latter. Also, you need to (at least) install gcc and make through the Cygwin installer. – slhck – 2017-07-13T07:29:38.007

Both "normal" python-2.7 and cygwin's python-3.6 are installed on my computer. Apparently easy_install, pip and pip3 were all connected to my python-2.7 installation. I could remove pip3 from my python-2.7 installation and install another version of pip through easy_install-3.6 (which is connected to python inside cygwin). – Loke Gustafsson – 2017-07-13T11:34:03.633

Despite all of this, I still get the very same error message when I run $ pip3 install numpy. I installed both gcc and make through the Cygwin installer, but I still get the same error message. – Loke Gustafsson – 2017-07-13T11:39:03.810

Any reason to not use python3-numpy package already available ? – matzeri – 2017-07-13T16:13:54.717

I hadn't thought about python3-numpy, but I still lack the ability to install modules not available through Cygwin. I tried this and fair enough, $ pip says that it works. However, when importing numpy in actual python code I receive an error about missing dependencies. (from . import multiarray --> ImportError: No such file or directory, this is inside numpy code) Sadly, this doesn't solve the problem with the missing dependencies that I can't figure out. – Loke Gustafsson – 2017-07-13T20:47:51.923

After reading up on what that . means, supposedly am I missing a file multiarray.py from site-packages\numpy\core. Is this correct? Although I do have a file called multiarray.cpython-36m-x86_64-cygwin.dll there. – Loke Gustafsson – 2017-07-13T20:53:09.127

No answers