Python and Conda Virtual Environments

Users can create one-off custom environments for their python or conda work that encapsulates exactly the setup that they want for a given type of work. This allows you to install packages in your own virtual enviroment that you can then load in a later session and use, knowing you have the packages you need.

You can do this with python virtual environments for just python.

You can create virtual environments in conda to also encapsulate other packages. We recommend that you do not run “conda install” to install your virtual environment in your .bashrc. Instead, activate it where the directory lives, which by default is in your home directory, ~/.conda/envs/.

If you wish to have conda loading commands in your .bashrc file (via conda install or otherwise) you can make the conda environment not load by default by running this command on the command line when you have your conda environment loaded:

conda config --set auto_activate_base false

After executing this conda config command the conda environment will still be set up in your .bashrc but it won’t be activated when you login. Without that configuration, having conda in your .bashrc file would mean that any time you ran any shell script your environment gets activated for that shell script, which takes time and system resources. After running the conda config command above, to use your conda environment after logging in, run “conda activate”.