Reproducibility and Sharing

Goal: Introduce how conda environments can be reproduced and shared.

Based on Managing Environments.


In the following examples, we assume you already have a miniconda3 module already loaded.


Clone an Environment

Existing Conda environments can be cloned (essentially copied).

[]$ conda create --help ... options: ... --clone ENV Create a new environment as a copy of an existing local environment. ...

Example

[]$ conda create -p py_env2 --clone py_env Retrieving notices: ...working... done Source: /home/<username>/.conda/envs/py_env Destination: /cluster/medbow/project/<project-name>/<username>/software/py_env2 Packages: 39 Files: 1 ... # # To activate this environment, use # $ conda activate /cluster/medbow/project/<project-name>/<username>/software/py_env2

Notice: The source (environment being cloned) and the destination (new cloned environment) are listed.

In the above, we are using the -p option so the destination is within the current working directory, and cloning from an existing environment that was created within the default environment location - so only its name (not absolute path) is required.

[]$ pwd /project/<project-name>/<username>/software []$ ls slim_env_4.2.2 []$ conda create -p py_env2 --clone py_env Retrieving notices: ...working... done Source: /home/<username>/.conda/envs/py_env Destination: /cluster/medbow/project/<project-name>/<username>/software/py_env2 Packages: 39 Files: 1 Downloading and Extracting Packages: Downloading and Extracting Packages: Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate /cluster/medbow/project/<project-name>/<username>/software/py_env2 # # To deactivate an active environment, use # # $ conda deactivate []$ ls py_env2 slim_env_4.2.2

Using Cloned Environment


Conda env command


Export an Environment


Import an Environment