Skip to content

Commit 10d6748

Browse files
committed
Promote mamba more in the documentation, hide CONDA_USES_MAMBA
See #8623.
1 parent 02a42b9 commit 10d6748

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

docs/feature-flags.rst

-12
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ In case you prefer to use the latest ``conda`` version available, this is the fl
2424
Makes Read the Docs to install all the requirements at once on ``conda create`` step.
2525
This helps users to pin dependencies on conda and to improve build time.
2626

27-
``CONDA_USES_MAMBA``: :featureflags:`CONDA_USES_MAMBA`
28-
29-
``conda`` solver consumes 1Gb minimum when installing any package using ``conda-forge`` channel.
30-
This seems to be `a known issue`_ due conda forge has so many packages on it, among others.
31-
Using this feature flag allows you to use mamba_ instead of ``conda`` to create the environment
32-
and install the dependencies.
33-
``mamba`` is a drop-in replacement for conda that it's much faster and also
34-
reduces considerably the amount of memory required to solve the dependencies.
35-
36-
.. _mamba: https://quantstack.net/mamba.html
37-
.. _a known issue: https://www.anaconda.com/understanding-and-improving-condas-performance/
38-
3927
``DONT_OVERWRITE_SPHINX_CONTEXT``: :featureflags:`DONT_OVERWRITE_SPHINX_CONTEXT`
4028

4129
``DONT_SHALLOW_CLONE``: :featureflags:`DONT_SHALLOW_CLONE`

docs/guides/build-using-too-many-resources.rst

+5-14
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,12 @@ you can create a custom requirements file just for documentation.
2525
This should speed up your documentation builds,
2626
as well as reduce your memory footprint.
2727

28-
Use pip when possible
29-
---------------------
28+
Use mamba instead of conda
29+
--------------------------
3030

31-
If you don't need ``conda`` to create your *documentation* environment,
32-
consider using ``pip`` instead since ``conda`` could `require too much memory`_ to calculate the dependency tree
33-
when using multiple channels.
34-
35-
.. _require too much memory: https://github.com/conda/conda/issues/5003
36-
37-
38-
.. tip::
39-
40-
Even though your *project* environment is created with ``conda``, it may be not necessary for the *documentation* environment.
41-
That is, to build the documentation is probably that you need fewer Python packages than to use your library itself.
42-
So, in this case, you could use ``pip`` to install those fewer packages instead of creating a big environment with ``conda``.
31+
If you need conda packages to build your documentation,
32+
you can :ref:`use mamba as a drop-in replacement to conda <guides/conda:Making builds faster with mamba>`,
33+
which requires less memory and is noticeably faster.
4334

4435
Document Python modules API statically
4536
--------------------------------------

docs/guides/conda.rst

+39-10
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,39 @@ To maximize compatibility, we recommend putting ``conda-forge`` above ``defaults
104104
.. _Anaconda Terms of Service: https://www.anaconda.com/terms-of-service
105105
.. _the relevant conda docs: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html?highlight=nodefaults#creating-an-environment-file-manually
106106

107+
Making builds faster with mamba
108+
-------------------------------
109+
110+
One important thing to note is that, when enabling the ``conda-forge`` channel,
111+
the conda dependency solver requires a large amount of RAM and long solve times.
112+
This is `a known issue`_ due to the sheer amount of packages available in conda-forge.
113+
114+
As an alternative, you can instruct Read the Docs to use mamba_,
115+
a drop-in replacement for conda that is much faster
116+
and reduces the memory consumption of the dependency solving process.
117+
118+
To do that, add a ``.readthedocs.yaml`` :doc:`configuration file </config-file/v2>`
119+
with these contents:
120+
121+
.. code-block:: yaml
122+
:caption: .readthedocs.yaml
123+
124+
version: 2
125+
126+
build:
127+
os: "ubuntu-20.04"
128+
tools:
129+
python: "mambaforge-4.10"
130+
131+
conda:
132+
environment: environment.yml
133+
134+
You can read more about the :ref:`config-file/v2:build.tools.python` configuration
135+
in our documentation.
136+
137+
.. _mamba: https://quantstack.net/mamba.html
138+
.. _a known issue: https://www.anaconda.com/understanding-and-improving-condas-performance/
139+
107140
Mixing conda and pip packages
108141
-----------------------------
109142

@@ -168,23 +201,19 @@ For example, this conda environment contains the required dependencies to compil
168201
Troubleshooting
169202
---------------
170203

171-
As explained in our
172-
:ref:`guide about build resources <guides/build-using-too-many-resources:Use pip when possible>`,
173-
``conda`` is known to `require too much memory`_ when solving the satisfiability problem
174-
for the specified dependencies. There are some conda-specific tips to consider to
175-
minimize the running time or the memory usage:
204+
If you have problems on the environment creation phase,
205+
either because the build runs out of memory or time
206+
or because some conflicts are found,
207+
you can try some of these mitigations:
176208

177209
- Reduce the number of channels in ``environment.yml``, even leaving ``conda-forge`` only
178210
and opting out of the defaults adding ``nodefaults``.
179211
- Constrain the package versions as much as possible to reduce the solution space.
180-
- Use mamba_, an alternative package manager fully compatible with conda packages,
181-
by requesting the ``CONDA_USES_MAMBA`` :ref:`feature flag <feature-flags:Feature Flags>`.
212+
- :ref:`Use mamba <guides/conda:Making builds faster with mamba>`,
213+
an alternative package manager fully compatible with conda packages.
182214
- And, if all else fails,
183215
:ref:`request more resources <guides/build-using-too-many-resources:Requests more resources>`.
184216

185-
.. _require too much memory: https://github.com/conda/conda/issues/5003
186-
.. _mamba: https://mamba.readthedocs.io/en/latest/
187-
188217
Custom Installs
189218
---------------
190219

0 commit comments

Comments
 (0)