Skip to content

Warning

This is as a Lab Notebook which describes how to solve a specific problem at a specific time. Please keep this in mind as you read and use the content. Please pay close attention to the date, version information and other details.

Transitioning from Anaconda to Miniforge

Due to recent changes in Terms of Service, ICER does not recommend or support the use of Anaconda or its package channels. However, ICER has provided streamlined access to the conda command and the conda-forge channels with Miniforge.

Follow the steps below to transition an existing Anaconda installation to Miniforge using the ICER-provided Miniforge module.

Replace module loads

Miniforge is pre-installed on the HPCC. You can access it with

1
2
module purge
module load Miniforge3

Anywhere you were previously using module load Conda/3, you can replace it with module load Miniforge3. For more details see our page on Using Conda.

Remove .condarc file

If you have an existing ~/.condarc file, this may conflict with the setup done by the new Miniforge3 module. To completely ignore it, run

1
mv ~/.condarc ~/.condarc.bak

You can still access your old file at ~/.condarc.bak. If you would like, you can instead edit your .condarc file to keep any configurations you previously set yourself (but use this step as a backup if the new module is not working correctly).

Get access to current environments

Optional

Note that if you complete this step, future Conda environments will be installed into your old installation's directory. You may wish to skip this step if you are planning to reinstall all current environments.

Assuming you have previously set the CONDA3PATH variable in your .bashrc file, you can run

1
conda config --append envs_dirs ${CONDA3PATH}/envs

to access all of your old Conda environments.

These environments may still use Anaconda

You are free to use these environments with Miniforge as most newly installed or updated packages will be installed from conda-forge. If a package cannot be found in the conda-forge channel however, the environment will still be configured to download from Anaconda's servers. Pay close attention to which channel Conda is attempting to install your packages from.

If you would like to avoid this, you can reinstall your entire environment. Read on...

Reinstall current environments

If you want to reinstall an environment using Miniforge, first, export its installed packages (we will assume the environment is called test_env):

1
2
conda activate test_env
conda env export --override-channels --from-history --channel conda-forge | head -n -1 > env.yaml

The above command may change versions of packages!

To ensure that you can reinstall your environments using the conda-forge channel and Miniforge, you need to strip out all version information (which is what --from-history does). However, this will likely install newer versions of the packages that you previously installed which may have unexpected outcomes!

If you need to use the same versions, try using

1
conda env export --override-channels --no-builds --channel conda-forge | head -n -1 > env.yaml

instead. Depending on whether the requested package versions are available in the conda-forge channels, this may not work. You may need to manually change versions to ones that are suitable for your work and can be found in conda-forge.

Then reinstall the package using Miniforge:

1
conda create --name test_env --file env.yaml

Reusing environment names

If you use the same name in the previous line as the existing environment name, you will be asked to delete the existing version first. If you are comfortable with the new environment (that may have different versions of packages, see above), you can agree. Otherwise, use a different name.

You can now access this environment using

1
conda activate test_env

and install new packages from conda-forge using

1
conda install <package_name>