This is an archival dump of old wiki content --- see scipy.org for current material

Installing SciPy from Source on Linux

Here are some examples of complete command sets required to build SciPy and related modules from scratch on GNU/Linux based systems.

I am assuming that the installation is as a non-priviledged user (typically installations as root can be easier because everything goes to a standard place) and hence needed to be careful about placing things in the appropriate places. This not only allows one to install things without root access, but allows different versions to be installed. In particular, on my system I included two versions, one compiled with GCC and another with the non-commercial Intel compilers.

I used the following directory structure: (I always provided absolute paths: the following are just shorthands.)

In order to allow people to use different versions I opted for altering the environmental variables PATHetc. with a couple of scripts ${BASE}/setenv_gcc and ${BASE}/setenv_intel. These are to be sourced before building (to ensure the correct compiler is chosen) and using the programs installed here.

-bash-3.00$ . ${BASE}/setenv_gcc
-bash-3.00$ python
Python 2.5 (r25:51908, Mar 28 2007, 04:11:35) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

-bash-3.00$ . ${BASE}/setenv_intel
-bash-3.00$ python
Python 2.5 (r25:51908, Mar 28 2007, 04:17:03) 
[GCC Intel(R) C++ gcc 3.4 mode] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

For constant use, one should add the following aliases to their startup files:

alias setenv_gcc=". ${BASE}/setenv_gcc"
alias setenv_intel=". ${BASE}/setenv_intel"

Here I describe two different builds. One is with the gcc compiler provided by Redhat. To attain reasonable speeds, I installed the ATLAS, LAPACK, and FFTW packages for SciPy. The second build uses the free Intel compiler for non-commercial use. Here I used the Intel provided MKL library in place of ATLAS etc. I had some problems compiling Python with the Intel compiler when optimizations were selected, so the Intel version was not completely optimized, but it still runs about 1.3 times faster than the gcc version for floating point operations (Disclaimer: this benchmark is extremely crude!):

-bash-3.00$ . ${BASE}/setenv_gcc  
-bash-3.00$ python
Python 2.5 (r25:51908, Mar 28 2007, 04:11:35) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from timeit import Timer
>>> Timer("for n in range(10): n**2").repeat(3)
[4.0674910545349121, 4.0540750026702881, 4.0841350555419922]
>>> Timer("for n in range(10): n**2.0").repeat(3)
[7.3370380401611328, 7.3262910842895508, 7.3424952030181885]
>>>

-bash-3.00$ . ${BASE}/setenv_intel
-bash-3.00$ python
Python 2.5 (r25:51908, Mar 28 2007, 04:17:03) 
[GCC Intel(R) C++ gcc 3.4 mode] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from timeit import Timer
>>> Timer("for n in range(10): n**2").repeat(3)
[4.351600170135498, 4.3792080879211426, 4.4070122241973877]
>>> Timer("for n in range(10): n**2.0").repeat(3)
[5.5847959518432617, 5.6334741115570068, 5.5757060050964355]
>>> 

SciPy: Installing_SciPy/Linux/BuildingFromSource (last edited 2015-10-24 17:48:26 by anonymous)