Skip to content

Commit

Permalink
set micromamba as default and recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jun 5, 2024
1 parent b664238 commit de3e5fc
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 76 deletions.
16 changes: 8 additions & 8 deletions docs/source/developer_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ Developer Notes
.. literalinclude:: ../../environment.yaml
:language: yaml

To build an environment from this unpinned environment definition, you may run the following:
To build an environment from this unpinned environment definition, run the following:

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
curl -L https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
mamba env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
curl -L https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
conda env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
.. _adding_a_package_to_stenv:

Expand Down
26 changes: 13 additions & 13 deletions docs/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ Frequently Asked Questions

You can use the environment definition YAML file (:ref:`environment_yaml`) in the root of the repository:

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
curl -L https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
mamba env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
curl -L https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
conda env create --name stenv --file https://raw.githubusercontent.com/spacetelescope/stenv/main/environment.yaml
This environment is unpinned, meaning it may take some time to resolve dependency versions.
Additionally, the resulting package versions may not have been tested for your platform.
Expand All @@ -42,25 +42,25 @@ some packages are not supported and / or deprecated, and some are deemed too nic

To install a package in your local environment, you can use ``pip install`` while the environment is activated:

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba activate stenv
micromamba activate stenv
pip install <package_name>
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda activate stenv
mamba activate stenv
pip install <package_name>
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
micromamba activate stenv
conda activate stenv
pip install <package_name>
To request that a new package be added to ``stenv`` (:ref:`environment_yaml`) for all users, see :ref:`adding_a_package_to_stenv`.
Expand Down
129 changes: 74 additions & 55 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,66 @@ Installation
Install Conda
-------------

A Conda distribution provides the ``conda`` command, which lets you create, manage, and activate new
environments. Try running the ``conda`` command in your terminal. If you get ``conda: command not found``
(or similar), you will need to install a conda distribution. If you already have a ``conda`` command in
your terminal, you can skip to the next step.
A Conda distribution provides the ``micromamba`` / ``mamba`` / ``conda`` command, which lets you create, manage, and switch to
(activate) environments. Try running ``micromamba``, ``mamba``, or ``conda`` in your terminal. If you get ``command not found``
(or similar), see below to install.

The easiest option is to install
`Miniconda <https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html>`_, which is
full-featured but installs a minimal set of default packages initially. We will install more packages later
on.
``mamba`` is a rewrite of ``conda`` that is much faster at resolving dependencies with near-parity of commands.
``micromamba`` is ``mamba`` packaged into a single binary, which makes installation and maintenance much easier.
For these reasons, I recommended you use ``micromamba``.

Alternatives include `Miniforge <https://github.com/conda-forge/miniforge#miniforge3>`_, which includes the
``mamba`` command (a much faster drop-in replacement for ``conda`` with all the same functionality) and
`Anaconda <https://www.anaconda.com/distribution/>`_ which provides a full-featured base environment as
well as hundreds of useful tools, libraries, and utilities by default.
.. tab:: micromamba

.. note::
The below instructions will work for any of the distributions, though users with ``mamba`` installed
will notice a speedup if they substitute ``mamba`` for ``conda`` where it appears in commands.
Run the following in your terminal to install ``micromamba``:

.. important::
Remember to run ``conda init`` when installing. This is required in order to set up your shell to
``activate`` and ``deactivate`` environments.
.. code-block:: shell
.. tab:: mamba
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
On macOS, you can alternatively install ``micromamba`` from `Homebrew <https://brew.sh/>`_:

.. code-block:: shell
brew install micromamba
You may also follow `these installation instructions <https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html>`_.

.. tab:: mamba

Follow
`these instructions to install Miniforge <https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html>`_,
which includes the ``mamba`` command in its base environment.

.. important::
Remember to run ``mamba init`` after installing. This is required in order to set up your shell to
``activate`` and ``deactivate`` environments.

.. code-block:: shell
mamba init
.. tab:: conda
.. tab:: conda

.. code-block:: shell
.. caution::
The Anaconda organization has
`updated their terms of service <https://legal.anaconda.com/policies/en/#:~:text=2.1%20Organizational%20Use.%C2%A0>`_
to indicate that any usage of their services requires a paid license, if used by an organization of
more than 200 users. This includes pulling packages from the Anaconda ``defaults`` channels, as well as installing
``conda`` itself.

conda init
We recommend that you use ``mamba`` and pull packages from the ``conda-forge`` channel, instead of using ``conda``
and the ``defaults`` channels.

.. tab:: micromamba
Follow `these instructions to install Miniconda <https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html>`_
which includes the ``conda`` command in its base environment.

.. important::
Remember to run ``conda init`` after installing. This is required in order to set up your shell to
``activate`` and ``deactivate`` environments.

.. code-block:: shell
micromamba init
conda init
.. _choose_release:

Expand Down Expand Up @@ -99,25 +119,24 @@ Right-click (or control-click on macOS) on the link to the release file and choo
``Copy Link Address``). Then, run the following command in a terminal, replacing ``<URL>`` with the URL you copied in the previous
step:

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba env create --name stenv --file <URL>
curl -L <URL> -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda env create --name stenv --file <URL>
mamba env create --name stenv --file <URL>
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
curl -L <URL> -o ~/Downloads/stenv.yaml
micromamba env create --name stenv --file ~/Downloads/stenv.yaml
conda env create --name stenv --file <URL>
.. note::
If the build does not succeed on your system, please refer to :ref:`build_fails`
Expand All @@ -140,23 +159,23 @@ In order to access the packages in ``stenv``, you must first ``activate`` the en
.. important::
If you chose another name when creating the environment, use that here instead.

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba activate stenv
micromamba activate stenv
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda activate stenv
mamba activate stenv
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
micromamba activate stenv
conda activate stenv
Activating a Conda environment changes which Python interpreter and packages are in use for that session
(i.e. terminal window). Now, if you try to ``import jwst``:
Expand All @@ -171,6 +190,12 @@ Every time you open a new terminal window, you will need to activate the environ
.. note::
You can show installed packages available within a Conda environment with ``conda list``:

.. tab:: micromamba

.. code-block:: shell
micromamba list
.. tab:: mamba

.. code-block:: shell
Expand All @@ -183,14 +208,14 @@ Every time you open a new terminal window, you will need to activate the environ
conda list
.. tab:: micromamba
To ``deactivate`` an environment and return your shell to normal, close your terminal window or run
``conda deactivate``:

.. code-block:: shell
.. tab:: micromamba

micromamba list
.. code-block:: shell
To ``deactivate`` an environment and return your shell to normal, close your terminal window or run
``conda deactivate``:
micromamba deactivate
.. tab:: mamba

Expand All @@ -204,12 +229,6 @@ To ``deactivate`` an environment and return your shell to normal, close your ter
conda deactivate
.. tab:: micromamba

.. code-block:: shell
micromamba deactivate
Deleting an environment
=======================

Expand All @@ -218,21 +237,21 @@ To delete an environment with all of its packages, run ``conda env remove --name
.. important::
If you chose another name when creating the environment, use that here instead.

.. tab:: mamba
.. tab:: micromamba

.. code-block:: shell
mamba env remove --name stenv
micromamba env remove --name stenv
.. tab:: conda
.. tab:: mamba

.. code-block:: shell
conda env remove --name stenv
mamba env remove --name stenv
.. tab:: micromamba
.. tab:: conda

.. code-block:: shell
micromamba env remove --name stenv
conda env remove --name stenv

0 comments on commit de3e5fc

Please sign in to comment.