Conda is a "Package, dependency and environment management (tool) for any language—Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN". Conda installs binaries instead of building packages from source code, so some packages installed with Conda may suffer a performance loss compared to packages built from source. Information on Conda and how to use it can be found on the following links to Conda's site:
Conda is already installed on the Coeus cluster and the stand alone compute servers, so there is no need to install Conda in your home directory.
Note: Do not use Conda for Python Tensor codes. Instead use a virtual environment described here.
Conda is not recommended unless you need the bioconda channel for specific bio python packages.
Conda is available on Coeus and the stand alone compute servers as part of the Intel Python module. To use Conda and the associated packages, load the module with the following commands on Coeus or the standalone compute servers:
$ module load python
To create an environment run the following command, specifying that it should have Python v.3.12:
$ conda create -n my_env python=3.12
To search for a package, use the search command:
$ conda search example_package
If the package cannot be found, that only means it is not in the default channel. Specify a channel to search with the -c option. Many packages are available on the conda-forge channel:
$ conda search example_package -c conda-forge
# or for bio research
$ conda search checkm2 -c bioconda
Install the package by replacing search with install:
$ conda install example_package
$ conda install example_package -c conda-forge
$ conda install checkm2 -c bioconda
To remove installed packages, there are two methods: either specify the package and environment, or load the environment and then remove it.
$ conda remove example_package --name my_clone
or
$ conda activate my_clone
(my_clone) $ conda remove example_package
To remove an entire environment, run the following:
$ conda remove --name my_clone --all
To output all currently available environments run the following command (currently active environment is indicated with *):
$ conda env list
To load a module execute the following command:
$ conda activate environment
(environment) $
To output all packages installed in the current environment:
(environment) $ conda list
# packages in environment at /vol/apps/hpc/stow/miniconda3/4.8.0:
#
# Name Version Build Channel
package_a 1.2.3 0 conda-forge
package_b 3.2.1 py27_0
. . .
To deactivate an environment:
(environment) $ conda deactivate
$
It is possible to save an environment to a file, as well as create an environemnt from a file. This can be beneficial for several reasons, like creating back ups or sharing with a collaborator or moving the work to a different machine.
Be sure to save the environment as a .yml file.
$ conda activate my_env
(my_env) $ conda env export > my_env.yml
$ conda env create -f my_env.yml