Conda environment in the terminal


The text below assumes that we run conda in the terminal. We need to update the instructions below for the situation where we interact with conda in Visual Studio Code.


  • You have Miniconda or Anaconda installed.

  1. Open your terminal shell (e.g. Bash or Zsh).

  2. Activate conda using conda activate or source ~/miniconda3/bin/activate. If neither works, please first follow Setting path to Conda from your terminal shell. You probably need to restart your shell terminal. Then try to activate conda again.

  3. Run the following command:

    $ conda env create -f
  4. Make sure that you see “coderefinery” in the output when you ask for a list of all available environments:

    $ conda env list

Activating the coderefinery environment

In the workshop, we will ask you to activate this environment.

First, follow the steps 1 and 2 in the above section (i.e. open your terminal shell and activate conda). Then run the following:

$ conda activate coderefinery

Alternatively you can use:

$ source activate coderefinery

Please note however that conda activate is preferred command since Conda v4.4.

If this does not work, the coderefinery part should be replaced with the whole path, for example:

$ source activate ~/Miniconda3/envs/coderefinery

How to verify the environment

Once activated, try the following 5 commands. You should see versions printed and not see errors (exact version numbers are not too important):

$ python --version

Python 3.11.0
$ jupyter-lab --version

$ pytest --version

$ sphinx-build --version

sphinx-build 5.3.0
$ snakemake --version


Deactivating the coderefinery environment

$ conda deactivate

Deleting the coderefinery environment

If you don’t need the coderefinery environment anymore, it is best to delete it. The following command will delete the whole environment:

$ conda remove --name coderefinery --all

In case you have both Anaconda3 and Miniconda3, check from which base environment the coderefinery environment was created, and first activate the corresponding base environment for the above command to work.

If you have an old coderefinery environment from a previous workshop

In this case it is safest to delete the old environment and recreate it.