Conda and Tethys Platform
Last Updated: September 2024
This guide provides tips for using Conda effectively in your Tethys environment.
Conda Channels
All of the dependencies for Tethys Platform are installed from the conda-forge
channel (see: Conda-Forge). We recommend that you install any additional packages that you need for development from conda-forge
as well to ensure compatibility with the dependencies already installed. To do so, provide the -c
option when installing packages:
conda install -c conda-forge <package>
Install from Conda-Forge Automatically
You may wish to configure your conda environment to automatically install packages from the conda-forge
channel as follows:
conda config --add channels conda-forge
This command will add the conda-forge
channel to the top of the channel list, making it the highest priority channel for retrieving packages. To learn more see Conda User Guide - Manage channels.
Using the libmamba Solver
The default solver for Conda is notoriously slow, especially in environments that have a lot of dependencies. Tethys development environments can accumulate dependencies as you install more packages and more apps.
The libmamba
solver is a much more efficient solver for Conda and is recommended when you run into issues where your environment is taking too long to solve or fails to solve (see: A Faster Solver for Conda: Libmamba). Follow the steps below to use the libmamba
solver with Tethys Platform.
Install
libmamba
in base environment:
conda update -n base conda
conda install -n base conda-libmamba-solver
Optionally, you may wish to set the
libmamba
solver as the default solver:
conda config --set solver libmamba
Install Tethys Platform
To install Tethys Platform using the libmamba
solver, run the command with the --solver
option:
conda create --solver libmamba -n tethys -c tethysplatform -c conda-forge tethys-platform django=<DJANGO_VERSION>
Alternatively, if you set libmamba
to be the default solver in step 2, run the install command as usual and libmamba
will be used automatically:
conda create -n tethys -c tethysplatform -c conda-forge tethys-platform django=<DJANGO_VERSION>
Important
Django Version
As of Tethys 3.4 and above, the version of Django is no longer pinned in the tethys-platform
package. You will need to specify the version of Django that you want to use when creating the environment. This is especially important for production installations, as only the LTS versions of Django recieve bug and security fixes. For development installations, we recommend using the same version of Django that you plan to use in production. For production installations, we recommend using the current LTS version of Django (see: How to get Django - Supported Versions. Failing to provide the Django version will result in installing the latest version of Django which may not be the LTS version.
Install Packages
You can also use the --solver
option to install new packages in the Tethys environment. Don't forget to activate the Tethys environment first:
conda activate tethys
conda install --solver libmamba -c conda-forge <package>
App Installation
The tethys install
command that is used to install apps, also installs dependencies of the app that are listed in its install.yml
. The tethys install
command will use the default solver you have configured. So to install app dependencies using the libmamba
solver, set the default solver to be libmamba
(see above) and then run the tethys install
command as usual.