-
Notifications
You must be signed in to change notification settings - Fork 660
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.7 or >=3.4)
- a C compiler (GNU
gcc
works), Microsoft Visual C++ 14.0 on Windows - the Python header files (typically in a package
python-dev
), - numpy and cython
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.7) 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
If you have problems ask on the mailing list.
One can also use pip. For all releases, you should be able to just do
pip --upgrade MDAnalysis
pip --upgrade MDAnalysisTests
and pip
will download the source distribution from the Python package index and install them, together with any required dependencies.
If you want to install from the checked out source, you can also use pip
:
pip [options] ./mdanalysis
for a standard installation.
A developer installation (that immediately reflects changes to the sources) can be done with
cd ./mdanalysis/package
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.