unable to `pip install numpy` on a specific machine
Asked Answered
S

2

5

pip install numpy in a python virtualenv on my own Mac OSX machine and on another of my machine running Arch Linux works perfectly.

Unfortunately, the same command fails to work on a colleague's machine running Gentoo.

Here's the pip.log showing the error logs:-

building data_files sources

build_src: building npy-pkg config files

running build_py

copying numpy/version.py -> build/lib.linux-x86_64-2.7/numpy

copying build/src.linux-x86_64-2.7/numpy/__config__.py -> build/lib.linux-x86_64-2.7/numpy

copying build/src.linux-x86_64-2.7/numpy/distutils/__config__.py -> build/lib.linux-x86_64-2.7/numpy/distutils

running build_clib

customize UnixCCompiler

customize UnixCCompiler using build_clib

running build_ext

customize UnixCCompiler

customize UnixCCompiler using build_ext

customize GnuFCompiler

customize IntelFCompiler

customize LaheyFCompiler

customize PGroupFCompiler

customize AbsoftFCompiler

customize NAGFCompiler

customize VastFCompiler

customize CompaqFCompiler

customize IntelItaniumFCompiler

customize IntelEM64TFCompiler

customize Gnu95FCompiler

customize Gnu95FCompiler

customize Gnu95FCompiler using build_ext

building 'numpy.linalg.lapack_lite' extension

compiling C sources

C compiler: x86_64-pc-linux-gnu-gcc -pthread -O3 -march=native -pipe -fomit-frame-pointer -fno-ident -fPIC



compile options: '-DNO_ATLAS_INFO=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'

x86_64-pc-linux-gnu-gcc: numpy/linalg/lapack_litemodule.c

x86_64-pc-linux-gnu-gcc: numpy/linalg/python_xerbla.c

/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so

/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'

collect2: ld returned 1 exit status

/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':

(.text+0x20): undefined reference to `main'

collect2: ld returned 1 exit status

error: Command "/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1

----------------------------------------

Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy

Exception information:
Traceback (most recent call last):
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
    requirement_set.install(install_options, global_options)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
    requirement.install(install_options, global_options)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy

It appears that the gfortran on my colleague's machine does not play well with the numpy package he is trying to install in the virtualenv. Any idea why this might be so?

Stallfeed answered 2/8, 2012 at 0:39 Comment(3)
If CFLAGS or LDFLAGS are set, it could cause this. They should be unset.Russ
You guessed right. This was the problem @jterrace! Would you like to provide this as the answer so I can close this question?Stallfeed
""" Solved by unsetting CFLAGS, CXXFLAGS and LDFLAGS from the environment. The script I'm sourcing looks like this: . /usr/bin/virtualenvwrapper.sh workon senatus_env export PS1="[senatus_env] ${PS1}" unset CFLAGS unset CXXFLAGS unset LDFLAGS """Stallfeed
R
7

If CFLAGS, CXXFLAGS, or LDFLAGS are set, it could cause this. The problem is that those environment variables override the settings in the compile script, causing problems.

Just unset them for the invocation of the pip command and you should be all set.

Russ answered 3/8, 2012 at 15:19 Comment(1)
It seems the same applies to scipy. See also github.com/numpy/numpy/issues/1171Olenolin
C
0

It looks to me that setuptools is not working correctly, setuptools has been superceded by the python "dist" utility so you might want to install that and retry the installation.

Clone answered 2/8, 2012 at 3:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.