How to install Miniconda on Linux using SLURM (Step-by-step)
Many developers and researchers use resource management for their calculation tasks. One of the well-known resource management is SLURM, which through that multiple job steps can be simultaneously submitted and queued.
SLURM has different pre-installed modules by the admin, such as miniconda, pip, and python with different versions, etc.
But if you are a machine learning developer, you may use Python for your development and need to implement your work in different virtual environments. For this, you have to work with miniconda and need to install it first. In this article, I teach you how to install miniconda on your allocated directory in SLURM.
Here are the steps to install Miniconda on Linux using SLURM:
- Download the Miniconda installation script by running the command: “wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
- Make the installation script executable by running the command: “chmod +x Miniconda3-latest-Linux-x86_64.sh”
- Run the installation script with the command: “./Miniconda3-latest-Linux-x86_64.sh” and follow the prompts to complete the installation.
- If you want to use conda on your SLURM cluster, you should add the path to your .bashrc file by running the command: “echo ‘export PATH=”/path/to/miniconda3/bin:$PATH”’ >> ~/.bashrc”
- Finally, activate the changes by running the command “source ~/.bashrc”
Note: You may need to change the path to miniconda3 in step 4 to the path where you installed it.
After installing Miniconda, you can initialize conda by running the following command in the terminal:
conda init
This command will initialize conda and add the necessary configuration to your shell’s configuration file (e.g. .bashrc or .bash_profile). The changes made by this command will take effect after you close and reopen the terminal or by running the command:
source ~/.bashrc
This command will make sure that the conda command is available in the terminal and the conda environment is activated whenever you open a new terminal window. Additionally, you can also activate conda by running the following command:
conda activate
This will activate the base conda environment, which is the default environment created during the installation of Miniconda.
You can also create new environments and activate them using the command:
conda create --name myenv
conda activate myenv
This will create a new environment named “myenv” and activate it. You can install packages, run scripts and so on within that environment.
Exceptions
If the command “bash Miniconda3-latest-Linux-x86_64.sh -b” is not working, you can try an alternative method to install Miniconda by running the following command:
sh Miniconda3-latest-Linux-x86_64.sh -b -p /path/to/install
This command will install Miniconda in the specified directory and the option -b is for running the installer in batch mode, meaning it will not prompt for user input during the installation process.
You can change ‘/path/to/install’ to the directory where you want to install Miniconda.
This method of installation should not require pyinstaller and will work even if your system is missing the necessary dependencies for pyinstaller.
After that you can follow the step 4 and 5 in my previous answer to activate conda.
If this command still doesn’t work, you may want to check with the administrator of the cluster to see if there are any compatibility issues or if Miniconda is already installed on the cluster.