Compiling and installing

The source code for pylada can be obtained from github.

Requirements

  • cmake: software tool to configure and create the makefiles. Any version 2.8 and larger should work. This program is often available on supercomputers via module load cmake.

  • Boost: A set of high-performance C++ libraries. Most of these libraries contain only header files. Hence, they can be installed rather easily. Pylada does not require any compiled boost. PyLada uses the following header-only libraries: mpl, enable if, type traits, preprocessor, bind, ref, static assert, exceptions. Most Linux distributions will contain Boost in some rpm of deb package. It is often not available on supercomputers and will need to be installed there.

    Note

    Pylada also uses boost.mpi in some of its default configuration scripts. It is a python package which interface with the MPI library. It is not strictly required and other MPI package could replace it in the relevant config files.

  • Eigen: An efficient C++ numerical library. This is a header-only library which is fairly easy to install with CMake. Versions 2 and 3 are supported.

  • Python: programming language with which to interface with Pylada. Should be between version 2.6.4 included and 3.0 excluded. Python is likely available by default on any unix system.

  • Numpy: a Python package for numerical calculations. It is available on all Linux distributions. It is often time available by default on supercomputers. If not, it can be installed via easy_install or pip.

  • quantities: A Python package which implements physical dimensions and units, such as length, weight, etc. It works well with Numpy. It is unlikely to be installed by default on any system. It can be installed easily with easy_install or pip.

  • IPython: an interactive shell for Python. It forms the basis of Pylada’s user-interface. It must be version 0.13 or higher. It can be installed in its simplest form without any of its optional dependencies. This package will not likely to be found installed by default. It can be installed easily with easy_install or pip.

  • sphinx: Only required to create the documentation. Can be installed via easy_install or pip.

  • ctest: Only required to run the test suite. It is distributed with cmake.

Procedure

On a unix machine

The following assumes the required packages listed above are installed. It also assumes that the source code for Pylada has been extracted to some directory.

The CMakeLists.txt file in the pylada root directory guides the build. It contains mechanisms to search for several required tools and packages (e.g. location of your c++ compiler). Due to frequent failure of automatic library detection mechanisms, and/or your desire to customize the process (e.g. install location), it is quite likely that some or all of the following variables will need to be manually specified in a separate file, e.g. myCmake-env.txt:

  • CMAKE_INSTALL_PREFIX
  • CMAKE_CXX_COMPILER
  • CMAKE_C_COMPILER
  • CMAKE_Fortran_COMPILER
  • PYTHON_LIBRARY
  • EIGEN3_INCLUDE_DIR

The syntax for such specifications is illustrated by the following example:

SET(CMAKE_INSTALL_PREFIX "/Users/pgraf/root/mylada" CACHE STRING "prefix")
SET(CMAKE_CXX_COMPILER "g++-mp-4.5"  CACHE STRING "c++")
SET(CMAKE_C_COMPILER "gcc-mp-4.5"  CACHE STRING "c")
SET(CMAKE_Fortran_COMPILER "gfortran-mp-4.5"  CACHE STRING "fortran")
SET(PYTHON_LIBRARY  "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib"   CACHE STRING "pylib")
SET(EIGEN3_INCLUDE_DIR  "/Users/pgraf/opt/eigen3.1.2/"   CACHE STRING "eigen3")

With such an auxilliary CMake file prepared (assuming it is myCmake-env.txt in the pylada root directory), the following steps configure pylada for building:

> cd directory/with/pylada/source
> mkdir build
> cd build
> cmake -C ../myCmake-env.txt ../

After this configuration is done, it is time to build and install pylada:

> make
> make install

The last two lines should see you through the installation.

Warning

cmake and Python don’t always interact well. You may want to do the following:

> ccmake ..

Then hit [t] for advanced options. Hit [/] followed by [PYTHON_INCLUDE_DIR] to look. This will bring you to PYTHON_INCLUDE_DIR. You should make sure that it points to the correct python version. Also check PYTHON_LIBRARY. cmake often picks up different version of python on a system.

Checking your installation

Be sure to adjust your PYTHONPATH environment variable to include the location you installed pylada. Then, in a python shell, try importing pylada:

>>> import pylada

If you have an error, then python does not know how to find the directory where Pylada was installed. Make sure that python is is set up correctly to include this directory. In general, it is defined by CMAKE_INSTALL_PREFIX and CMAKE_PYINSTALL_PREFIX.

Once the above works:

> cd path/to/pylada/source
> cd build
> make test

This will run Pylada’s unit-tests. It may take some time. Hopefully, most tests will run. Note that some tests for VASP and such will require that Pylada be configured first, e.g., told how to find the relevant programs.

Beyond this base installation, there are additional steps required to get pylada working with VASP, with your batch queueing system, and with IPython. Please see Setting up Pylada

Creating the documentation

This documentation is generated using sphinx. Assuming that python can find the Pylada installation, the documentation can be generated (from the above build directory) with:

> make documentation

This will create a directory “build/sphinx” with an “index.html” file. View it with your favorite browser and voilà! In order for links to the pylada source code to be included in the documentation, the PYTHONPATH must point to the installed pylada source.

Note

Virtualenv users will want to do pip install sphinx to make sure that sphinx is started using the virtualenv python.

Compatibility

Unices with gnu compiler, intel compiler, but not Portland compiler (eigen does not compile). Known to work on Mac OS/X.

Table Of Contents

Previous topic

User Guide

Next topic

Setting up Pylada

This Page