Using Conda in a Research Space
Conda can be used in a research space to share environments with your research group or students in your class. This makes reproducibility and teaching easier.
Note
This page assumes familiarity with conda from our Using conda guide.
Creating the environment
To create an environment in a research space, first make sure you are set to the correct group by following the instructions on our group change page.
-
Create the environment in the research space with the command:
conda create --prefix /mnt/research/<your research space>/envs/<environment name> <other conda commands and packages>This will create the environment in a directory called
envsin the root of the research space. Modify the path as needed for your research space structure.A specific example command is
conda create --prefix /mnt/research/helpdesk/envs/plotting-tools matplotlibwhich would install an environment called
plotting-toolsin thehelpdeskresearch space, and install thematplotlibpackage and its dependencies. -
Modify your .condarc file to add the path of your environments directory with the command:
conda config --append envs_dirs <path to your research space environment>For the example in step 1, this would be
conda config --append envs_dirs /mnt/research/helpdesk/envs -
Verify that the environment is detected with the command
conda env listand for the example from step 1 you would get the output
output# conda environments: # # * -> active # + -> frozen plotting-tools /mnt/research/helpdesk/envs/plotting-tools base /opt/software-current/2023.06/x86_64/generic/software/Miniforge3/25.11.0-1and then you can activate the environment as normal using its name.
-
Modify the environment as necessary to meet your needs.
-
Optional: prevent others from modifying the environment by changing the write permissions on the environment directory. The command would be
chmod -R g-w <path to the environment>which for the example from step 1 would be
chmod -R g-w /mnt/research/helpdesk/envs/plotting-tools