...
Table of Contents | ||
---|---|---|
|
...
Note |
---|
In the following examples, we assume you already have a |
...
Clone an Environment
Info |
---|
Existing Conda environments can be cloned (essentially copied). |
Code Block |
---|
[salexan5@mblog2 ~]$ conda create --help
...
options:
...
--clone ENV Create a new environment as a copy of an existing local environment.
... |
Example
Code Block |
---|
[salexan5@mblog2 software]$ conda create -p py_env2 --clone py_env Retrieving notices: ...working... done Source: /home/salexan5<username>/.conda/envs/py_env Destination: /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2 Packages: 39 Files: 1 ... # # To activate this environment, use # $ conda activate /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2 |
Info |
---|
Notice: The source (environment being cloned) and the destination (new cloned environment) are listed. In the above, we are using the |
Expand | ||
---|---|---|
| ||
|
...
Note |
---|
Notice how you need to activate/use this cloned environment: |
Code Block |
---|
[salexan5@mblog2 ~]$ cat ~/.conda/environments.txt /home/salexan5<username>/.conda/envs/py_env /project/arcc<project-name>/salexan5<username>/conda/envs/r_env /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/slim_env_4.2.2 /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2 [salexan5@mblog2 ~]$ conda info --env # conda environments: # base /apps/u/opt/linux/miniconda3/24.3.0 /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2 /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/slim_env_4.2.2 py_env /home/salexan5<username>/.conda/envs/py_env r_env /project/arcc<project-name>/salexan5<username>/conda/envs/r_env |
Info |
---|
Need to define the full path to activate. |
Code Block |
---|
[salexan5@mblog2 ~]$ conda activate /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2 (/cluster/medbow/project/arcc<project-name>/salexan5<username>/software/py_env2) [salexan5@mblog2 ~]$ |
Export an Environment
Code Block |
---|
[salexan5@mblog2 ~]$ conda activate r_env
(r_env) [salexan5@mblog2 ~]$ conda env export > r_env.yml
(r_env) [salexan5@mblog2 ~]$ conda deactivate
[salexan5@mblog2 ~]$ cat r_env.yml
name: r_env
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
...
- zstd=1.5.5=hc292b87_2
prefix: /project/arcc/salexan5/conda/envs/r_env |
Conda env command
...
Conda env command
Info |
---|
The |
Code Block |
---|
[]$ conda env --help
usage: conda env [-h] command ...
positional arguments:
command
config Configure a conda environment.
create Create an environment based on an environment definition file.
export Export a given environment
list List the Conda environments.
remove Remove an environment.
update Update the current environment based on environment file.
options:
-h, --help Show this help message and exit. |
...
Export an Environment
Info |
---|
Within an active environment we can export into a readable file a description of the entire Conda environment. This describes all the system related libraries as well as anything that that was explicitly |
Code Block |
---|
[]$ conda activate r_env
(r_env) []$ conda env export > r_env.yml
(r_env) []$ conda deactivate
[]$ cat r_env.yml
name: r_env
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
...
- zstd=1.5.5=hc292b87_2
prefix: /project/<project-name>/<username>/conda/envs/r_env |
...
Import an Environment
Info |
---|
Using the |
Code Block |
---|
[salexan5@mblog2 software]$ cd /project/<project-name>/<username>/software/ []$ conda env create -p r_env2 --file r_env.yml ... # # To activate this environment, use # # $ conda activate /cluster/medbow/project/arcc<project-name>/salexan5<username>/software/r_env2 ... |
...
Prev | Workshop HomeWorkshop | Next |