How To: How do I handle Conda environments?

Summary

How do I handle Conda environments?

Body

How do I handle Conda environments? 

 

Installing additional packages in your conda environment 

Once you have created a Conda environment as described in our article on creating Conda environments, you can modify it by installing additional Conda packages that you need for your workflow.  

Make sure to get an interactive session, load the same Conda module that you used when creating an environment and activate the environment. 

If you do not remember the name of your Conda environment do 

conda env list  

to see available environments. 

Once the environment is active you can list already installed packages by 

conda list 

And you can install additional packages – for example pandas 

conda install pandas 

After it finishes installation, you should be able to test it 

(vina) [plmx7@c021 ~]$ python 

Python 3.14.3 | packaged by conda-forge | (main, Feb  9 2026, 21:56:02) [GCC 14.3.0] on linux 

Type "help", "copyright", "credits" or "license" for more information. 

>>> import pandas 

>>> pandas.__version__ 

'3.0.3' 

>>> 

Press Ctrl-D to exit Python.  

See the sections of Conda Channels and Conda Packages on how to handle some details when installing packages. 

 

Deleting a conda environment 

Before deleting a Conda environment make sure that the environment is not active.  

Then remove it with 

conda env remove --name ENVNAME 

 

Rebuilding or Moving Conda Environments 

The recommended method for moving an environment to a new location is to save its configuration and rebuild it in the new location, so the instructions for both processes are the same. 

To create a configuration file for a Conda environment, run the following commands: 

# Activate the env you wish to export 

source activate ENVNAME 

# Export the configuration 

conda env export > ENVNAME.yml 

If you are simply moving to a new system, copy the file and rebuild the env. 

conda env create -f ENVNAME.yml 

If you need to specify a location for just this one env, you can specify a prefix. 

conda env create -f ENVNAME.yml -p /path/to/install/location/ 

In principle you should be able to rebuild the environment that you have on another computer and bring it to Hellbender using this method.

Using Conda Enironment with Jupyter in OpenOnDemand 

There is a simple way to use your conda environment as a kernel in Jupyter in OpenOnDemand. You need to do this only once for your environment and after you do this it should be visible as a kernel in Jupyter notebook. 

First you must connect to the Hellbender cluster, request an interactive session and activate the environment that you wish to import in the Jupyter 

source activate ENVNAME 

Next, you must install two additional packages to the environment 

conda install -c anaconda ipykernel 

Finally, you must install the environment as a kernel 

python -m ipykernel install --user --name=KERNEL_ENVNAME 

Now when you open Jupyter in OpenOnDemand you should see your environment in the kernel selection dropdown menu with the name KERNEL_ENVNAME. 

Conda Channels

Whenever we use conda create or conda install without mentioning a channel name, Conda package manager searches its default channels to install the packages. If you are looking for specific packages that are not in the default channels you must mention them by using: 

conda create --name env_name --channel channel1 --channel channel2 ... package1 package2 ... 

For example, the following creates new_env and installs r-sf, shapely and bioconductor-biobase from r, conda-forge and bioconda channels: 

conda create --name new_env --channel r --channel conda-forge --channel bioconda r-sf shapely bioconductor-biobase 

Conda Packages 

To find the required packages, we can visit anaconda.org and search for packages to find their full name and the corresponding channel. Another option is using conda search command. Note that you will need to search the right channel to find packages that are not in the default channels. For example: 

conda search --channel bioconda biobase 

 

Details

Details

Article ID: 2837
Created
Wed 9/16/26 4:22 PM
Modified
Tue 11/10/26 3:51 PM