Install with conda

$ conda install -c conda-forge mbuild

Alternatively you can add all the required channels to your .condarc after which you can simply install without specifying the channels:

$ conda config --add channels conda-forge
$ conda install mbuild


The order in which channels are added matters: conda-forge should be the highest priority as a result of being added last. In your .condarc file, it should be listed first.


The MDTraj website makes a nice case for using Python and in particular the Anaconda scientific python distribution to manage your numerical and scientific Python packages.

Install an editable version from source

To make your life easier, we recommend that you use a pre-packaged Python distribution like Miniconda in order to get all of the dependencies:

$ git clone
$ cd mbuild
$ conda env create -f environment-dev.yml
$ conda activate mbuild-dev
$ pip install -e .


The above installation is for OSX and Unix. If you are using Windows, use environment-win.yml instead of environment-dev.yml

Install pre-commit

We use pre-commit to automatically handle our code formatting and this package is included in the dev environment. With the mbuild-dev conda environment active, pre-commit can be installed locally as a git hook by running:

$ pre-commit install

And (optional) all files can be checked by running:

$ pre-commit run --all-files

Supported Python Versions

Python 3.6, 3.7 and 3.8 are officially supported, including testing during development and packaging. Support for Python 2.7 has been dropped as of August 6, 2019. Other Python versions, such as 3.9 and 3.5 and older, may successfully build and function but no guarantee is made.

Testing your installation

mBuild uses py.test for unit testing. To run them simply run the following while in the base directory:

$ conda install pytest
$ py.test -v

Building the documentation

mBuild uses sphinx to build its documentation. To build the docs locally, run the following while in the docs directory:

$ pip install -r requirements.txt
$ make html