You do not have permission to edit this page, for the following reason:
The action you have requested is limited to users in the group: Users.
Free text:
__TOC__ = Set up conda environment and use it in your slurm job = For VRLab, it is ideal to install your own instance of [https://docs.anaconda.com/free/miniconda/index.html miniconda] in your directory. Then it doesn’t have to interfere with any of the existing versions on the cluster. Here’s how you can do it step by step. 1. Download the relevant <code>miniconda</code> distribution. You can do this with <code>wget</code>. For example: <syntaxhighlight lang="bash" line> wget "https://repo.anaconda.com/miniconda/Miniconda3-py310_23.11.0-1-Linux-x86_64.sh%20-O%20miniconda.sh") </syntaxhighlight> 2. Install the downloaded distribution of <code>miniconda</code> with a specified path in your directory. This specified path must be one where you have rights to install it. Assuming your <code>pwd</code> is where the distribution is present, enter: <syntaxhighlight lang="bash" line> bash miniconda.sh -b -p /net/labdata/geet/miniconda </syntaxhighlight> Don't forget to change your username ;) 3. Add the miniconda path to your <code>PATH</code>: <syntaxhighlight lang="bash" line> export PATH="/net/labdata/geet/miniconda/bin:$PATH" </syntaxhighlight> 4. Check if conda is installed properly by runnning <code>conda -V</code> or by checking the list of environments with <code>conda info –envs</code> 5. If step-4 works with no issues, initiate conda with <syntaxhighlight lang="bash" line> conda init </syntaxhighlight> 6. Now restart your shell, e.g. with <syntaxhighlight lang="bash" line> ssh shell-1 </syntaxhighlight> All of these were one-time steps! Once you have your own conda installation, you can create your environment and then modify it to your needs. One way to do this is, if you have a YAML file with a list of libraries, you can create and populate an environment with <syntaxhighlight lang="bash" line> conda env create -f environment.yml </syntaxhighlight> Many more details of managing conda environments can be found in [https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#managing-environments conda's documentation]. For your slurm job to use your environment, it must first initialize conda and then activate the environment. To do so, you simply need to add two lines in your <code>.sbatch</code> file. At the point in your job, where you want your environment to be activated (this must be after all <code>#SBATCH</code> parameters are provided), add the following lines: <syntaxhighlight lang="bash" line> source ~/.bashrc conda activate my_conda_environment </syntaxhighlight>