La instalación de numpy de Python sigue fallando

La instalación de numpy de Python sigue fallando

Estoy intentando instalar numpy pero la instalación sigue fallando por algún motivo.
En realidad lo que necesito es Python.no aprender, pero numpy (y scipy) son dependencias.

Entonces corrí:

sudo pip install numpy

Pero esto falla con el registro de instalación:

Downloading/unpacking numpy
  Running setup.py (path:/tmp/pip_build_root/numpy/setup.py) egg_info for package numpy
    Running from numpy source directory.

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.pyd' found anywhere in distribution
Installing collected packages: numpy
  Running setup.py install for numpy
    /bin/sh: 1: svnversion: not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    non-existing path in 'numpy/f2py': 'docs'
    non-existing path in 'numpy/f2py': 'f2py.1'
    F2PY Version 2
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    openblas_info:
      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

    /bin/sh: 1: svnversion: not found
    non-existing path in 'numpy/lib': 'benchmarks'
    lapack_opt_info:
    openblas_lapack_info:
    C compiler: cc

    compile options: '-c'
    cc: /tmp/tmpazdxtcf1/source.c
    cc /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1/source.o -lopenblas -o /tmp/tmpazdxtcf1/a.out
      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

      FOUND:
        libraries = ['openblas']
        language = f77
        library_dirs = ['/usr/lib']

    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    build_src
    building py_modules sources
    building library "npymath" sources
    customize Gnu95FCompiler
    Found executable /usr/bin/gfortran
    customize Gnu95FCompiler
    customize Gnu95FCompiler using config
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC

    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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
    success!
    removing: _configtest.c _configtest.o _configtest
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC

    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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest
    _configtest.o: In function `main':
    /tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'
    collect2: error: ld returned 1 exit status
    _configtest.o: In function `main':
    /tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'
    collect2: error: ld returned 1 exit status
    failure.
    removing: _configtest.c _configtest.o
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC

    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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
     int exp (void);
         ^
    x86_64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest
    success!
    removing: _configtest.c _configtest.o _configtest
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/ieee754.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math_complex.c
    building library "npysort" sources
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/quicksort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/mergesort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/heapsort.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h
      adding 'build/src.linux-x86_64-3.4/numpy/core/src/private' to include_dirs.
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/selection.c
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h
    conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/binsearch.c
    None - nothing done with h_files = ['build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h']
    building extension "numpy.core._dummy" sources
    Generating build/src.linux-x86_64-3.4/numpy/core/include/numpy/config.h
    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC

    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 -Inumpy/core/include -I/usr/include/python3.4m -c'
    x86_64-linux-gnu-gcc: _configtest.c
    _configtest.c:1:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    _configtest.c:1:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    failure.
    removing: _configtest.c _configtest.o
    Running from numpy source directory.
    /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_root/numpy/setup.py", line 251, in <module>
        setup_package()
      File "/tmp/pip_build_root/numpy/setup.py", line 243, in setup_package
        setup(**metadata)
      File "/tmp/pip_build_root/numpy/numpy/distutils/core.py", line 169, in setup
        return old_setup(**new_attr)
      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 "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 62, in run
        r = self.setuptools_run()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
        return distutils_install.run(self)
      File "/usr/lib/python3.4/distutils/command/install.py", line 583, 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 "/tmp/pip_build_root/numpy/numpy/distutils/command/build.py", line 39, in run
        old_build.run(self)
      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 "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 153, in run
        self.build_sources()
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources
        self.build_extension_sources(ext)
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources
        sources = self.generate_sources(sources, ext)
      File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
        source = func(extension, build_dir)
      File "numpy/core/setup.py", line 432, in generate_config_h
        moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
      File "numpy/core/setup.py", line 42, in check_types
        out = check_types(*a, **kw)
      File "numpy/core/setup.py", line 293, in check_types
        "Cannot compile 'Python.h'. Perhaps you need to "\
    SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
    Complete output from command /usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lsbot4u_-record/install-record.txt --single-version-externally-managed --compile:
    /bin/sh: 1: svnversion: not found

non-existing path in 'numpy/distutils': 'site.cfg'

non-existing path in 'numpy/f2py': 'docs'

non-existing path in 'numpy/f2py': 'f2py.1'

F2PY Version 2

blas_opt_info:

blas_mkl_info:

  libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']

  NOT AVAILABLE



openblas_info:

  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



/bin/sh: 1: svnversion: not found

non-existing path in 'numpy/lib': 'benchmarks'

lapack_opt_info:

openblas_lapack_info:

C compiler: cc



creating /tmp/tmpazdxtcf1/tmp

creating /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1

compile options: '-c'

cc: /tmp/tmpazdxtcf1/source.c

cc /tmp/tmpazdxtcf1/tmp/tmpazdxtcf1/source.o -lopenblas -o /tmp/tmpazdxtcf1/a.out

  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



  FOUND:

    libraries = ['openblas']

    language = f77

    library_dirs = ['/usr/lib']



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.linux-x86_64-3.4

creating build/src.linux-x86_64-3.4/numpy

creating build/src.linux-x86_64-3.4/numpy/distutils

building library "npymath" sources

customize Gnu95FCompiler

Found executable /usr/bin/gfortran

customize Gnu95FCompiler

customize Gnu95FCompiler using config

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC



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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest

success!

removing: _configtest.c _configtest.o _configtest

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC



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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’

 int exp (void);

     ^

x86_64-linux-gnu-gcc -pthread _configtest.o -o _configtest

_configtest.o: In function `main':

/tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'

collect2: error: ld returned 1 exit status

_configtest.o: In function `main':

/tmp/pip_build_root/numpy/_configtest.c:6: undefined reference to `exp'

collect2: error: ld returned 1 exit status

failure.

removing: _configtest.c _configtest.o

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC



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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’

 int exp (void);

     ^

x86_64-linux-gnu-gcc -pthread _configtest.o -lm -o _configtest

success!

removing: _configtest.c _configtest.o _configtest

creating build/src.linux-x86_64-3.4/numpy/core

creating build/src.linux-x86_64-3.4/numpy/core/src

creating build/src.linux-x86_64-3.4/numpy/core/src/npymath

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/ieee754.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npymath/npy_math_complex.c

building library "npysort" sources

creating build/src.linux-x86_64-3.4/numpy/core/src/npysort

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/quicksort.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/mergesort.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/heapsort.c

creating build/src.linux-x86_64-3.4/numpy/core/src/private

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h

  adding 'build/src.linux-x86_64-3.4/numpy/core/src/private' to include_dirs.

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/selection.c

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h

conv_template:> build/src.linux-x86_64-3.4/numpy/core/src/npysort/binsearch.c

None - nothing done with h_files = ['build/src.linux-x86_64-3.4/numpy/core/src/private/npy_partition.h', 'build/src.linux-x86_64-3.4/numpy/core/src/private/npy_binsearch.h']

building extension "numpy.core._dummy" sources

Generating build/src.linux-x86_64-3.4/numpy/core/include/numpy/config.h

C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC



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 -Inumpy/core/include -I/usr/include/python3.4m -c'

x86_64-linux-gnu-gcc: _configtest.c

_configtest.c:1:20: fatal error: Python.h: No such file or directory

 #include <Python.h>

                    ^

compilation terminated.

_configtest.c:1:20: fatal error: Python.h: No such file or directory

 #include <Python.h>

                    ^

compilation terminated.

failure.

removing: _configtest.c _configtest.o

Running from numpy source directory.

/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'define_macros'

  warnings.warn(msg)

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/numpy/setup.py", line 251, in <module>

    setup_package()

  File "/tmp/pip_build_root/numpy/setup.py", line 243, in setup_package

    setup(**metadata)

  File "/tmp/pip_build_root/numpy/numpy/distutils/core.py", line 169, in setup

    return old_setup(**new_attr)

  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 "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 62, in run

    r = self.setuptools_run()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run

    return distutils_install.run(self)

  File "/usr/lib/python3.4/distutils/command/install.py", line 583, 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 "/tmp/pip_build_root/numpy/numpy/distutils/command/build.py", line 39, in run

    old_build.run(self)

  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 "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 153, in run

    self.build_sources()

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 170, in build_sources

    self.build_extension_sources(ext)

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 329, in build_extension_sources

    sources = self.generate_sources(sources, ext)

  File "/tmp/pip_build_root/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources

    source = func(extension, build_dir)

  File "numpy/core/setup.py", line 432, in generate_config_h

    moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)

  File "numpy/core/setup.py", line 42, in check_types

    out = check_types(*a, **kw)

  File "numpy/core/setup.py", line 293, in check_types

    "Cannot compile 'Python.h'. Perhaps you need to "\

SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.

----------------------------------------
Cleaning up...
Command /usr/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lsbot4u_-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/numpy
Storing debug log for failure in /home/mikel/.pip/pip.log

Ahí dice Perhaps you need to install python-dev|python-develpero no lo hago. Cuando intento instalar python-dev dice:

python-dev is already the newest version.

Supongo que la fuente del problema es la advertencia:

_configtest.c:1:5: warning: conflicting types for built-in function ‘exp’
 int exp (void);

Pero no tengo idea de cómo abordar esto.

Respuesta1

Solo se puede instalar la versión anterior con pip. Es posible que desees instalar la última versión con git.

La versión corta es:

sudo apt-get install python3.4-dev
git clone [email protected]:dnouri/nolearn.git
cd nolearn
pip install -r requirements.txt
python setup.py develop

Esto debería instalarse incluyendo todos los requisitos.

También necesitas el paquete de desarrollo Python 3.4.

Fuentes:

https://github.com/dnouri/nolearn

https://stackoverflow.com/questions/24892810/python-3-4-and-2-7-cannot-install-numpy-package-for-python-3-4

información relacionada