Difference between revisions of "Creaing and using conda environment"

From HPC Guide
Jump to navigation Jump to search
 
Line 1: Line 1:
In order to use conda, please load module miniconda/miniconda3-4.7.12-environmentally, using command:
+
In order to use conda or mamba, please load module miniconda/miniconda3-4.7.12-environmentally, using command:
 
<pre>
 
<pre>
 
module load miniconda/miniconda3-4.7.12-environmentally
 
module load miniconda/miniconda3-4.7.12-environmentally
 
</pre>
 
</pre>
+
Or
 +
<pre>
 +
module load mamba/mamba-1.5.8
 +
</pre>
 
To see all available environment you may type the below command. Maybe there is already an environment for what you need
 
To see all available environment you may type the below command. Maybe there is already an environment for what you need
 
<pre>
 
<pre>
Line 30: Line 33:
 
conda activate /a/home/cc/staff/dvory/envs/new_env
 
conda activate /a/home/cc/staff/dvory/envs/new_env
 
</pre>
 
</pre>
To install something in your conda environment:
+
To install something in your conda environment
 +
 
 +
First, need to make sure that your cache is defined in a writable path, e.g. your home directory. So the following needs to be defined:
 +
<pre>
 +
export CONDA_PKGS_DIRS=$HOME/.conda/pkgs
 +
export CONDA_ENVS_DIRS=$HOME/.conda/envs
 +
export MAMBA_ROOT_PREFIX=$HOME/.mamba
 +
</pre>
 +
 
 +
Then you may install whatever you need
 
<pre>
 
<pre>
 
conda install <module>
 
conda install <module>

Latest revision as of 11:07, 31 March 2025

In order to use conda or mamba, please load module miniconda/miniconda3-4.7.12-environmentally, using command:

module load miniconda/miniconda3-4.7.12-environmentally

Or

module load mamba/mamba-1.5.8

To see all available environment you may type the below command. Maybe there is already an environment for what you need

conda env list

And to load an environment, please perform:

conda activate <module path>/envs/<MODULENAME>

E.g.:

conda activate /powerapps/share/centos7/miniconda/miniconda3-4.7.12-environmentally/envs/jupyter

If you would like to have your own environment within this conda, and to be able to install there something, please perform the following right after loading the environmentally module:

conda create --prefix <path in your space>

E.g.

conda create --prefix /a/home/cc/staff/dvory/envs/new_env

Then activate it with

conda activate /a/home/cc/staff/dvory/envs/new_env

To install something in your conda environment

First, need to make sure that your cache is defined in a writable path, e.g. your home directory. So the following needs to be defined:

export CONDA_PKGS_DIRS=$HOME/.conda/pkgs
export CONDA_ENVS_DIRS=$HOME/.conda/envs
export MAMBA_ROOT_PREFIX=$HOME/.mamba

Then you may install whatever you need

conda install <module>

To deactivate an environment:

conda deactivate

To unload a module:

module unload <module name>