Zhuanghua Liu Zhuanghua Liu - 3 months ago 16
Python Question

upgrade scipy in redhat

I'm trying to upgrade scipy on Redhat 6.7 using pip to local folder:

pip install --user --upgrade scipy


However, the following error pop out:

You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting scipy
Using cached scipy-0.18.0.tar.gz
Installing collected packages: scipy
Running setup.py install for scipy
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-i0GYOd/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aq6BzP-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:

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 scipy` (last SciPy release on PyPI)


lapack_opt_info:
lapack_mkl_info:
mkl_info:
libraries mkl,vml,guide not found in /usr/local/lib64
libraries mkl,vml,guide not found in /usr/local/lib
libraries mkl,vml,guide not found in /usr/lib64
libraries mkl,vml,guide not found in /usr/lib
NOT AVAILABLE

NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib64
libraries lapack_atlas not found in /usr/local/lib64
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib64/atlas
numpy.distutils.system_info.atlas_threads_info
Setting PTATLAS=ATLAS
Setting PTATLAS=ATLAS
FOUND:
libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
library_dirs = ['/usr/lib64/atlas']
language = f77
include_dirs = ['/usr/include']

/usr/lib64/python2.6/site-packages/numpy/distutils/command/config.py:394: DeprecationWarning:
+++++++++++++++++++++++++++++++++++++++++++++++++
Usage of get_output is deprecated: please do not
use it anymore, and avoid configuration checks
involving running executable on the target machine.
+++++++++++++++++++++++++++++++++++++++++++++++++

DeprecationWarning)
customize GnuFCompiler
Found executable /usr/bin/g77
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize GnuFCompiler
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize GnuFCompiler using config
compiling '_configtest.c':

/* This file is generated from numpy/distutils/system_info.py */
void ATL_buildinfo(void);
int main(void) {
ATL_buildinfo();
return 0;
}
C compiler: gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC

compile options: '-c'
gcc: _configtest.c
gcc -pthread _configtest.o -L/usr/lib64/atlas -llapack -lptf77blas -lptcblas -latlas -o _configtest
ATLAS version 3.8.4 built by mockbuild on Thu Feb 9 08:22:21 EST 2012:
UNAME : Linux x86-010.build.bos.redhat.com 2.6.18-274.17.1.el5 #1 SMP Wed Jan 4 22:45:44 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
INSTFLG : -1 0 -a 1
ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_P4E -DATL_CPUMHZ=3600 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
F2CDEFS : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
CACHEEDGE: 524288
F77 : gfortran, version GNU Fortran (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
F77FLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
SMC : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
SMCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
SKC : gcc, version gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
SKCFLAGS : -fomit-frame-pointer -mfpmath=387 -O2 -falign-loops=4 -g -Wa,--noexecstack -fPIC -m64
success!
removing: _configtest.c _configtest.o _configtest
FOUND:
libraries = ['lapack', 'ptf77blas', 'ptcblas', 'atlas']
library_dirs = ['/usr/lib64/atlas']
language = f77
define_macros = [('ATLAS_INFO', '"\\"3.8.4\\""')]
include_dirs = ['/usr/include']

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-i0GYOd/scipy/setup.py", line 415, in <module>
setup_package()
File "/tmp/pip-build-i0GYOd/scipy/setup.py", line 411, in setup_package
setup(**metadata)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/core.py", line 152, in setup
config = configuration()
File "/tmp/pip-build-i0GYOd/scipy/setup.py", line 335, in configuration
config.add_subpackage('scipy')
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 957, in add_subpackage
caller_level = 2)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 926, in get_subpackage
caller_level = caller_level + 1)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 863, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/setup.py", line 9, in configuration
config.add_subpackage('cluster')
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 957, in add_subpackage
caller_level = 2)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 926, in get_subpackage
caller_level = caller_level + 1)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 863, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/cluster/setup.py", line 24, in configuration
extra_info=blas_opt)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/misc_util.py", line 1419, in add_extension
ext = Extension(**ext_args)
File "/usr/lib64/python2.6/site-packages/numpy/distutils/extension.py", line 45, in __init__
export_symbols)
TypeError: __init__() takes at most 4 arguments (13 given)

----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-i0GYOd/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-aq6BzP-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-i0GYOd/scipy


It seems numpy is out-dated, when I tried to upgrade numpy, similar error message show up. How should I install numpy and scipy in local folder?

Answer

RedHat 6.7 comes with Python 2.6 and that is no longer supported by the latest version of numpy/scipy. Apart from that, on Linux, you should not mix packages installed with the package manager (using yum, dnf, apt-get, etc.) with packages installed from PyPI using pip. Since most Linux distributions rely on a working Python to be installed for all kinds of programs, a pip install can easily break things, even so if this is done in a non-global directory.

Instead always use a virtualenv and install the package that you need there. You can install virtualenv with your package manager, and if you want you can create a virtualenv for virtualenv and upgrade pip and virtualenv there to get rid of the message that pip is outdated and get the latest virtualenv.

This might seem overkill, but it is worth preventing your utilities from breaking. In addition working this way makes it easy to use a newer python than the one provided by the system. Assuming you installed the latest from the 2.7 series in /opt/python/2.7, just provide -p /opt/python/2.7/bin/python to the system virtualenv when you create your initial virtualenv (using virtualenv from the package manager).

Comments