next up previous contents index
Next: Install scipy module for Up: Installing PyGILDAS Previous: Python module readline for   Contents   Index

Install NumPy module for Python

NumPy is mandatory for the Gildas-Python binding. Building and installing it requires some specific options and setting a correct environment. You can follow these steps:

  1. Download NumPy from:

  2. Unpack and compile NumPy. You can build NumPy either for the Python installed on your system or for a custom one: the build will be done for the Python which is seen from your shell (which python).
    cd <compilation-directory>
    tar xvzf numpy-1.3.0.tar.gz
    cd numpy-1.3.0
    python build --fcompiler=<compiler>
    Usually gnu95 is the correct argument for the -fcompiler option. Else (or if your want to know more), you should consider the following point:
      The two most popular open source fortran compilers are g77 and gfortran.
    Unfortunately, they are not ABI compatible, which means  that  concretely
    you should  avoid  mixing  libraries  built  with  one  with  another. In
    particular, if your blas/lapack/atlas is built with g77, you  *must*  use
    g77 when building numpy and scipy; on the  contrary,  if  your  atlas  is
    built with gfortran, you *must* build numpy/scipy with gfortran.
    * Choosing the fortran compiler
      - To build with g77:
        python build --fcompiler=gnu
      - To build with gfortran:
        python build --fcompiler=gnu95
    * How to check the ABI of blas/lapack/atlas?
      One relatively simple and reliable way to check for the  compiler  used
    to build a library is to use ldd  on  the  library.  If  is  a
    dependency, this means that g77 has been used.  If  is  a
    dependency, gfortran has been used. If both are dependencies, this  means
    both have been used, which is almost always a very bad idea.
    In other words, for standard users, NumPy has a linear algebra module (linalg) which is linked with the system's blas/lapack/atlas libraries. This implies that the Fortran sources of NumPy must be compiled with the same compiler which was used for the libraries. Check e.g. with ldd /usr/lib(64)/ which compiler you will have to use.

  3. Install NumPy:
    python install [--prefix=/some/custom/installation/prefix]
    The installation prefix (-prefix) is required only if you want to install NumPy in a location different from your Python installation directory (e.g. you are using the default Python executable provided by your system but you do not have root permissions). In this case (only), you will have to fill the $PYTHONPATH environment variable to indicate where Python can find NumPy.
    In the other cases, Python will install the module into its own installation directory, which is fine in particular when you are using a custom installation of Python. In this case you will also not have to augment the $PYTHONPATH since the module is installed in a standard location known by Python.

  4. Check the installation. Launch Python and type:
    import numpy
    You should recognize the installation path and the correct NumPy version.

next up previous contents index
Next: Install scipy module for Up: Installing PyGILDAS Previous: Python module readline for   Contents   Index
Gildas manager 2018-05-27