The latest versions of MDAnalysis can be installed using conda or pip. Currently, the conda releases only support serial calculations. If you plan to use the parallel OpenMP algorithms, you need to install MDAnalysis with pip and have a working OpenMP installation.
MDAnalysis has a separate test suite MDAnalysisTests that is required to run the test cases and examples. The test files change less frequently, take up around 90 MB of space, and are not needed for daily use of MDAnalysis. However, they are often used in examples, including many in this User Guide. If you are not interested in developing MDAnalysis or using the example files, you most likely don’t need the tests. If you want to run examples in the User Guide, install the tests. The tests are distributed separately from the main package.
If you are installing on Windows, you must have Microsoft Visual C++ 14.0 installed. If your installation fails with the error message:
error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools for Visual Studio”: https://visualstudio.microsoft.com/downloads/
Try installing Build Tools for Visual Studio from https://visualstudio.microsoft.com/downloads/ (scroll down to the Tools for Visual Studio section).
If you encounter any issues following these instructions, please ask for help on the user mailing list.
To install the latest stable version of MDAnalysis via
conda, use the following command. This installs all dependencies needed for full analysis functionality (excluding external programs such as HOLE):
conda install -c conda-forge mdanalysis
conda update mdanalysis
To install the tests:
conda install -c conda-forge MDAnalysisTests
The following command will install or upgrade the latest stable version of MDAnalysis via
pip, with core dependencies. This means that some packages required by specific analysis modules will not be installed.
pip install --upgrade MDAnalysis
If you need to install a fully-featured MDAnalysis, add the
analysis tag. As with
conda, this will not install external programs such as HOLE.
pip install --upgrade MDAnalysis[analysis]
To install/upgrade tests:
pip install --upgrade MDAnalysisTests
To install development versions of MDAnalysis, you can compile it from source. In order to install from source, you will need
cython. See Creating a development environment for instructions on how to create a full development environment.
git clone https://github.com/MDAnalysis/mdanalysis cd mdanalysis # assuming you have already installed required dependencies pip install -e .
The tests rely on the pytest and numpy packages, which must also be installed. Run tests with:
pytest --disable-pytest-warnings --pyargs MDAnalysisTests
All tests should pass (i.e. no FAIL, ERROR); SKIPPED or XFAIL are ok. If anything fails or gives an error, ask on the user mailing list or raise an issue.
Testing MDAnalysis can take a while, as there are quite a few tests. The plugin pytest-xdist can be used to run tests in parallel.
pip install pytest-xdist pytest --disable-pytest-warnings --pyargs MDAnalysisTests --numprocesses 4
MDAnalysisData is an additional package with datasets that can be used in example tutorials. You can install it with
# conda conda install -c conda-forge mdanalysisdata # pip pip install --upgrade MDAnalysisData
This installation does not download all the datasets; instead, the datasets are cached when they are first downloaded using a Python command.