Skip to content

Commit faa7623

Browse files
orbeckstIAlibay
andauthored
fix installation instructions and recommend mamba instead of conda (#370)
* fix #361 * recommend mamba over conda * include standard mamba installation instructions * See @mikemhenry comment #361 (comment) * fix #368 * fix install instructions * recommend Python 3.12 and recommend to remove unsupported opt packages --------- Co-authored-by: IAlibay <[email protected]>
1 parent a08963a commit faa7623

File tree

1 file changed

+118
-65
lines changed

1 file changed

+118
-65
lines changed

doc/source/contributing_code.rst

Lines changed: 118 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,37 @@ You can do this either with :ref:`conda <dev-with-conda>` or :ref:`pip <dev-with
6969

7070
.. _dev-with-conda:
7171

72-
With conda
73-
----------
72+
With conda-forge packages
73+
-------------------------
74+
75+
We will use pre-compiled packages from the `conda-forge <https://conda-forge.org/>`_ repository.
76+
77+
The program to manage these packages is called :program:`conda` although for the following we recommend using the faster one called :program:`mamba`. We will use ``mamba`` for the examples but you can equally use ``conda`` instead.
7478

75-
Install either `Anaconda <https://www.anaconda.com/download/>`_
76-
or `miniconda <https://conda.io/miniconda.html>`_.
77-
Make sure your conda is up to date:
79+
* For ``mamba``, follow the `mamba installation instructions <https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html>`_ or the `miniforge installation instructions <https://github.com/conda-forge/miniforge?tab=readme-ov-file#install>`_.
80+
* For ``conda`` install either the `Anaconda <https://www.anaconda.com/download/>`_ distribution or `miniconda <https://conda.io/miniconda.html>`_.
81+
82+
Make sure your :program:`mamba` (or :program:`conda`) is up to date:
7883

7984
.. code-block:: bash
8085
81-
conda update conda
86+
mamba update mamba
8287
83-
Create a new environment with ``conda create``. This will allow you to change code in
88+
Create a new environment with ``mamba create``. This will allow you to change code in
8489
an isolated environment without touching your base Python installation, and without
8590
touching existing environments that may have stable versions of MDAnalysis. :
8691

8792
.. code-block:: bash
8893
89-
conda create --name mdanalysis-dev "python>=3.9"
94+
mamba create --name mdanalysis-dev "python>=3.12"
9095
9196
Use a recent version of Python that is supported by MDAnalysis for this environment.
9297

9398
Activate the environment to build MDAnalysis into it:
9499

95100
.. code-block:: bash
96101
97-
conda activate mdanalysis-dev
102+
mamba activate mdanalysis-dev
98103
99104
.. warning::
100105
Make sure the :code:`mdanalysis-dev` environment is active when developing MDAnalysis.
@@ -103,19 +108,19 @@ To view your environments:
103108

104109
.. code-block:: bash
105110
106-
conda info -e
111+
mamba info -e
107112
108113
To list the packages installed in your current environment:
109114

110115
.. code-block:: bash
111116
112-
conda list
117+
mamba list
113118
114119
.. note::
115120
When you finish developing MDAnalysis you can deactivate the environment with
116-
:code:`conda deactivate`, in order to return to your root environment.
121+
:code:`mamba deactivate`, in order to return to your root environment.
117122

118-
See the full `conda documentation <http://conda.pydata.org/docs>`__ for more details.
123+
See the full `mamba documentation <https://mamba.readthedocs.io/en/latest/index.html>`_ or the full `conda documentation <https://docs.conda.io/projects/conda/>`_ for more details.
119124

120125
.. _dev-with-pip:
121126

@@ -204,49 +209,77 @@ This sets the number of files to 4096. However, this command only applies to you
204209
Building MDAnalysis
205210
-------------------
206211

207-
With conda
208-
----------
212+
With mamba/conda
213+
----------------
209214

210215
.. note::
211216
Make sure that you have :ref:`cloned the repository <forking-code-repo>`
212-
and activated your virtual environment with :code:`conda activate mdanalysis-dev`.
217+
and activated your virtual environment with :code:`mamba activate mdanalysis-dev`.
213218

214-
First we need to install dependencies. You'll need a mix of conda and pip installations:
219+
First we need to install the dependencies. To install the base MDAnalysis
220+
dependencies, do the following:
215221

216222
.. code-block:: bash
217223
218-
conda install -c conda-forge \
219-
'Cython>=0.28' \
220-
'numpy>=1.21.0' \
221-
'biopython>=1.80' \
222-
'networkx>=2.0' \
223-
'GridDataFormats>=0.4.0' \
224+
mamba install -c conda-forge \
225+
'cython>=0.28' \
226+
'fasteners' \
227+
'griddataformats>=0.4.0' \
228+
'hypothesis' \
229+
'matplotlib-base>=1.5.1' \
230+
'mdahole2-base' \
231+
'mda-xdrlib' \
224232
'mmtf-python>=1.0.0' \
225-
'joblib>=0.12' \
233+
'numpy>=1.23.2' \
234+
'packaging' \
235+
'pathsimanalysis' \
236+
'pytest' \
226237
'scipy>=1.5.0' \
227-
'matplotlib>=1.5.1' \
238+
'threadpoolctl' \
228239
'tqdm>=4.43.0' \
229-
'threadpoolctl'\
230-
'packaging' \
231-
'fasteners' \
232-
'netCDF4>=1.0' \
233-
'h5py>=2.10' \
240+
'waterdynamics'
241+
242+
243+
You can also install the following optional dependencies, although please note
244+
that they many not all be available for your machine type. Specifically,
245+
*hole2*, and *distopia* are only available on Linux + x86_64 machines, and *openmm*
246+
is not available for Windows. Simply remove any optional package that
247+
is not available for your operating system/architecture from your list.
248+
249+
.. code-block:: bash
250+
251+
mamba install -c conda-forge \
252+
'biopython>=1.80' \
234253
'chemfiles>=0.10' \
235-
'pyedr>=0.7.0' \
236-
'pytng>=0.2.3' \
254+
'clustalw=2.1' \
255+
'distopia>=0.2.0' \
256+
'duecredit' \
237257
'gsd>3.0.0' \
238-
'rdkit>=2020.03.1' \
258+
'h5py>=2.1.0' \
259+
'hole2' \
260+
'joblib>=0.12' \
261+
'netcdf4' \
262+
'networkx' \
263+
'openmm' \
239264
'parmed' \
240-
'seaborn' \
265+
'pyedr>0.7.0' \
266+
'pytest-xdist' \
267+
'pytest-cov' \
268+
'pytest-timeout' \
269+
'pytng>=0.2.3' \
270+
'rdkit>=2020.03.1' \
241271
'scikit-learn' \
242-
'tidynamics>=1.0.0' \
243-
'mda-xdrlib'
272+
'seaborn>=0.7.0' \
273+
'tidynamics>1.0.0'
244274
245275
# documentation dependencies
246-
conda install -c conda-forge 'mdanalysis-sphinx-theme>=1.3.0' docutils sphinx-sitemap sphinxcontrib-bibtex pybtex pybtex-docutils
247-
python -m pip install docutils sphinx-sitemap sphinxcontrib-bibtex pybtex pybtex-docutils
276+
mamba install -c conda-forge \
277+
'mdanalysis-sphinx-theme>=1.3.0' \
278+
docutils \
279+
sphinxcontrib-bibtex \
280+
sphinx-sitemap
248281
249-
Ensure that you have a working C/C++ compiler (e.g. gcc or clang). You will also need Python ≥ 3.9. We will now install MDAnalysis.
282+
Ensure that you have a working C/C++ compiler (e.g. :program:`gcc` or :program:`clang`). You will also need Python ≥ 3.10 (which you already installed in your virtual environment). We will now install MDAnalysis.
250283

251284
.. code-block:: bash
252285
@@ -268,7 +301,7 @@ At this point you should be able to import MDAnalysis from your locally built ve
268301
$ python # start an interpreter
269302
>>> import MDAnalysis as mda
270303
>>> mda.__version__
271-
'2.6.0-dev0'
304+
'2.8.0-dev0'
272305
273306
274307
With pip and virtualenv
@@ -279,45 +312,65 @@ With pip and virtualenv
279312
and activated your virtual environment with :code:`source myproject-env/bin/activate`
280313
(or :code:`workon my-project` if you used the `virtualenvwrapper package <https://virtualenvwrapper.readthedocs.io/en/latest/>`_)
281314

282-
Install the dependencies:
315+
First we need to install the dependencies. To install the base MDAnalysis
316+
dependencies, do the following:
283317

284318
.. code-block:: bash
285319
286320
python -m pip install \
287-
'Cython>=0.28' \
288-
'numpy>=1.21.0' \
289-
'biopython>=1.80' \
290-
'networkx>=2.0' \
291-
'GridDataFormats>=0.4.0' \
321+
'cython>=0.28' \
322+
'fasteners' \
323+
'griddataformats>=0.4.0' \
324+
'hypothesis' \
325+
'matplotlib>=1.5.1' \
326+
'mdahole2' \
327+
'mda-xdrlib' \
292328
'mmtf-python>=1.0.0' \
293-
'joblib>=0.12' \
329+
'numpy>=1.23.2' \
330+
'packaging' \
331+
'pathsimanalysis' \
332+
'pytest' \
294333
'scipy>=1.5.0' \
295-
'matplotlib>=1.5.1' \
334+
'threadpoolctl' \
296335
'tqdm>=4.43.0' \
297-
'threadpoolctl'\
298-
'packaging' \
299-
'fasteners' \
300-
'netCDF4>=1.0' \
301-
'h5py>=2.10' \
336+
'waterdynamics'
337+
338+
You can also install the following optional dependencies (note that
339+
you will not be able to install all the optional dependencies as
340+
many not available via `pip`, e.g. `clustalw`):
341+
342+
.. code-block:: bash
343+
344+
python -m pip install \
345+
'biopython>=1.80' \
302346
'chemfiles>=0.10' \
303-
'pyedr>=0.7.0' \
304-
'pytng>=0.2.3' \
347+
'distopia>=0.2.0' \
348+
'duecredit' \
305349
'gsd>3.0.0' \
306-
'rdkit>=2020.03.1' \
350+
'h5py>=2.1.0' \
351+
'joblib>=0.12' \
352+
'netcdf4' \
353+
'networkx' \
307354
'parmed' \
308-
'seaborn' \
355+
'pyedr>0.7.0' \
356+
'pytest-xdist' \
357+
'pytest-cov' \
358+
'pytest-timeout' \
359+
'pytng>=0.2.3' \
360+
'rdkit>=2020.03.1' \
309361
'scikit-learn' \
310-
'tidynamics>=1.0.0' \
311-
'mda-xdrlib'
362+
'seaborn>=0.7.0' \
363+
'tidynamics>1.0.0'
312364
313-
# for building documentation
365+
# documentation dependencies
314366
python -m pip install \
315-
sphinx 'mdanalysis-sphinx-theme>=1.3.0' sphinx-sitemap \
316-
pybtex docutils pybtex-docutils sphinxcontrib-bibtex
367+
'mdanalysis-sphinx-theme>=1.3.0' \
368+
docutils \
369+
sphinxcontrib-bibtex \
370+
sphinx-sitemap
317371
318-
Some packages, such as ``clustalw``, are not available via pip.
319372
320-
Ensure that you have a working C/C++ compiler (e.g. gcc or clang). You will also need Python ≥ 3.9. We will now install MDAnalysis.
373+
Ensure that you have a working C/C++ compiler (e.g. gcc or clang). You will also need Python ≥ 3.10. We will now install MDAnalysis.
321374

322375
.. code-block:: bash
323376
@@ -339,7 +392,7 @@ At this point you should be able to import MDAnalysis from your locally built ve
339392
$ python # start an interpreter
340393
>>> import MDAnalysis as mda
341394
>>> mda.__version__
342-
'2.7.0-dev0'
395+
'2.8.0-dev0'
343396
344397
345398
.. _branches-in-mdanalysis:

0 commit comments

Comments
 (0)