October 31, 2024
Loading and Initializing Conda with miniforge
To use Python on SciC Linux Clusters, load the miniforge3 module. Type the command below at the $ prompt on the SciC Linux Clusters command line
$ module load miniforge3
Creating and activating environments
To create a new environment, you can use the conda create
command :
$ conda create -n <env-name> [packages to be installed]
This will create a new environment with the given name in the default location, which is $HOME/.conda/envs
. For example, to create a new environment called 'test-python that will have python 3.8 installed:
$ conda create -n test-python-3.8 python=3.8
If you would like to create an environment in a location other than the default, use the -p flag instead of the -n flag to specify a path:
$ conda create -p path/to/envs/<env-name> [packages to be installed]
To view the environments you have created:
$ conda env list
Finally, to activate your conda environment:
$ conda activate <env-name>
Once activated, you can now start installing using all the python packages included with Anaconda.
Adding additional packages
Use the conda install
tool to get python packages. When using the conda install tool, it is helpful to include which channel you would like the package installed from. Different conda channels offer different builds of each package. Do not use "defaults" channel unless you purchased Anaconda license. More information on using channels can be found here.
(env-name) $ conda install -c <channel-name> package_name
You could also install a package with pip:
(env-name) $ pip install --user package_name
Using the "--user" option ensures that the package is installed in your home directory. Without this option you would get an error message as permissions will not allow pip to install in the SciC Linux Clusters software repository. We recommend to use pip installation only in cases when conda installation is not available.
Creating virtual environments
Refer to this FAQ and the online documentation for more information on setting up virtual environments