-
Notifications
You must be signed in to change notification settings - Fork 659
Installing from source
MDAnalysis is open source and you can always build and install the package from source. This gives you the flexibility to use either the latest releases or, if you like living on the cutting edge, you can also use the current development version of the code. This page contains notes on how to install from source.
For alternative ways to install MDAnalysis, see the page Install.
MDAnalysis is also distributed in source form. In order to build the library some C code needs to be compiled. Thus you will need
- python (>=2.6)
- a C compiler (GNU
gcc
works), - the Python header files (typically in a package
python-dev
), - numpy to compile the DCD reader and numerical extensions,
See Additional non-standard packages below for what else you need at run time.
The source code can be obtained via the Downloads page and as described below under Getting the source. The primary dependency is numpy.
Please read through this whole document. Installing MDAnalysis is unfortunately not always absolutely straightforward because of the various dependencies on other packages. InstallRecipes collects a number of examples of how MDAnalysis has been successfully installed on various systems; possibly one of the recipes applies to your situation, too, and you can simply copy and paste.
You can either get the source tar files or check out the source code from the git repository.
In order to download the source packages, you need to go to the PyPI repositories:
- https://pypi.python.org/pypi/MDAnalysis (main package)
- https://pypi.python.org/pypi/MDAnalysisTests (for the tests) and download the tar files from there.
Alternatively, you can check out the MDAnalysis directory from the git repository at https://github.com/MDAnalysis/mdanalysis. In most cases simply do
git clone https://github.com/MDAnalysis/mdanalysis
cd mdanalysis
If you have cloned the repository before, all you need to do is
git pull
to update your files.
If you want to install MDAnalysis from source you will need a C compiler.
We recommend (for python >= 2.6) the following way of installing in your home directory (a so called "user" installation) ::
python setup.py build
python setup.py install --user
If you want to install in the system wide python directory you will probably require administrative privileges, and so do
sudo python setup.py install
It is also possible to use --prefix
, --home
, or --user
options for
setup.py
to install in a different (probably your private) python
directory hierarchy.
If you have problem at this stage then have a look at the operating system specific notes at the end of this file or look in the issue tracker --- maybe the problem is recognized and a workaround can be found in the comments
Unfortunately, installing python packages is not always completely straightforward, so please read through these docs and perhaps ask on the mailing list.
In you should be able to use
python setup.py install --prefix LOCAL_DIRECTOY
or any of the other options of distutil's setup.py to install in alternative directories.
Please ask on the mailing list for help with installation and/or file a bug through the issue tracker.
One can also use EasyInstall. You should be able to do
easy_install [options] ./mdanalysis
for a standard installation (see easy_install docs for details).
If you downloaded a tar archive from the web you can
- unpack the archive
- easy_install the unpacked archive It would look similar to
tar -zxvf MDAnalysis-0.7.3.tar.gz
easy_install MDAnalysis-0.7.3 MDAnalysis[tests,analysis]
Note that the additional requirements [tests,analysis]
tell easy_install to download and install additional packages required for this functionality.
A developer installation (that immediately reflects changes to the sources) can be done with
cd ./mdanalysis
python setup develop [options]
For testing one can simply use
python setup.py develop --install-dir=$HOME/python-lib/ --script-dir=$HOME/bin
This builds and installs a working version in
~/python-lib/MDAnalysis
which is linked to the unpacked source. Then add $HOME/python-lib
to the PYTHONPATH
export PYTHONPATH=${PYTHONPATH}:$HOME/python-lib
However, the developer installation above is probably cleaner.
See the operating system specific notes below for hints how to get the necessary packages through the native package management system. Please add your own (eg for RPM based systems which the developers are not using heavily).
-
python-dev includes
Python.h
, which is required for compiling. - numpy is used at the compilation stage to find maths libraries.
- scipy, biopython, netcdf4-python are only needed when one wants to use all MDAnalysis functions but are not required for compiling.
In order to make full use of the library in your own python code you will need at least
- numpy of version 1.5 or greater
- scipy
- matplotlib
- BioPython's Bio.PDB (MDAnalysis will complain if you don't have Biopython installed (even though it is not used by default anymore))
- networkx --- for analysis of lipid leaflets via MDAnalysis.analysis.leaflet
- GridDataFormats
- netcdf4-python: If you want to operate on AMBER binary trajectories (NetCDF) then you will need to have working NetCDF support based on the netcdf4-python package.
In order to run the UnitTests you will need
- numpy >=1.5
- nose >= 1.3.7
See also InstallRecipes for "copy & paste" installation instructions for various operating systems and versions.
sudo apt-get install python-dev python-cython python-numpy g++
Install packages needed for full functionality
sudo apt-get install python-scipy python-matplotlib python-biopython libhdf5-dev
(If you have issues with the netcdf libraries see the wiki page on netcdf); the netcdf and libhdf5-dev packages are required if you want to be able to process AMBER netcdf (binary) trajectories.)
- Tested with GNU compilers
Tested 10.6.8+MacPorts
port install py26-numpy py26-cython
port install py26-scipy py26-matplotlib py26-biopython hdf5 netcdf+dap+netcdf4
(The netcdf and libhdf5-dev packages are only required if you want to be able to process AMBER netcdf (binary) trajectories.)
Other packages such as networkx and GridDataFormats are automagically installed when running {{python setup.py install}} (or easy_install
or pip
).
Tested with Mac OS X 10.4.11+fink (has not been tested since 2011 — feedback is welcome)
Install prerequisite packages using fink
fink install cython-py25 scipy-core-py25 scipy-py25
Install packages needed for full functionality
fink install matplotlib-py25 biopython-py25
NOTE: Use the Apple-provided gcc
, not the fink provided one. Apparently, only Apple's gcc has the -arch
flag that appears to be required for python setup.py install
. (Thanks to Justin Lemkul for pointing it out; see Issues after Installation). In order to install Apple's gcc you will need to install the Apple Developer Tools that come on one of the additional installation disks with the Mac or install Xcode from the web (note that Xcode 3.x is free and can be obtained by registering online for the Apple Developer Connection).
The above instructions should work for the latest version. Older versions of MDAnalysis had different requirements.
A LAPACK library is required (standard LAPACK/BLAS, ATLAS, or the Intel Math Kernel Library (MKL); on Mac OS X we simply use the native fast VecLib framework so you don't have to install anything else).
On Mac OS X we use the systems vecLib for fast linear algebra and nothing needs to be configured. On Linux you will probably want to use something such as ATLAS or the Intel Math Kernel Libraries for better performance for the rms fitting.
The fast math library paths are set in setup.cfg
. By default we ship a template file setup.cfg.template
that you can
cp setup.cfg.template setup.cfg
and edit. See the file itself for examples and the ones below.
Linux section of setup.cfg
(your paths are probably different from the
ones in this example)::
[linux]
fast_numeric_include = /opt/intel/cmkl/10.0.5.025/include
fast_numeric_linkpath = /opt/intel/cmkl/10.0.5.025/lib/em64t
fast_numeric_libs = mkl_lapack mkl guide
If you want to use the ATLAS LAPACK libraries use something such as ::
[linux]
fast_numeric_include = /usr/include
fast_numeric_linkpath = /usr/lib/atlas
fast_numeric_libs = lapack
Your paths could be different. Use a command such as
locate lapack
or your package manager to get an idea of where the files are to be found.
On some versions of Ubuntu we had to use
[linux]
# Ubuntu 9.04 i686
fast_numeric_include = /usr/include
fast_numeric_linkpath = /usr/lib/sse2/atlas
fast_numeric_libs = lapack
sudo apt-get install liblapack-dev # see below for notes on fast_numeric_*