不能在特定的机器上安装numpy。

时间:2022-04-23 22:41:05

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

pip在我自己的Mac OSX机器上的python virtualenv中安装了numpy,在我的另一台运行Arch Linux的机器上安装了一个完美的系统。

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

不幸的是,同样的命令不能用于运行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?

看来我同事的机器上的gfortran不适合他在virtualenv中安装的numpy包。知道为什么会这样吗?

2 个解决方案

#1


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.

如果设置了CFLAGS、CXXFLAGS或LDFLAGS,则可能导致此结果。问题是,这些环境变量覆盖了编译脚本中的设置,造成了问题。

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

只需要取消它们来调用pip命令,您就应该全部设置好了。

#2


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.

在我看来,setuptools不能正常工作,setuptools已经被python“dist”实用程序所取代,所以您可能想要安装它并重试安装。

#1


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.

如果设置了CFLAGS、CXXFLAGS或LDFLAGS,则可能导致此结果。问题是,这些环境变量覆盖了编译脚本中的设置,造成了问题。

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

只需要取消它们来调用pip命令,您就应该全部设置好了。

#2


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.

在我看来,setuptools不能正常工作,setuptools已经被python“dist”实用程序所取代,所以您可能想要安装它并重试安装。