conda problem: Could not find conda environment

2021-12-23
#Unix #Python

1. Introduction

The problem occurs on Ubuntu 20.04 LTS as:

$ conda activate python2.7
Could not find conda environment: python2.7
You can list all discoverable environments with `conda info --envs`.

Actually, python2.7 is located at /home/deng/anaconda3/envs.

2. Steps

This command is effective as:

$ conda activate /home/deng/anaconda3/envs/python2.7

It needs to add the path into the system envs_dirs by:

$ conda config --show envs_dirs
envs_dirs:
  - /home/deng/.conda/envs
  - /opt/intel/oneapi/intelpython/latest/envs
$ conda config --append envs_dirs /home/deng/anaconda3/envs/
$ conda config --show envs_dirs
envs_dirs:
  - /home/deng/anaconda3/envs
  - /home/deng/.conda/envs
  - /opt/intel/oneapi/intelpython/latest/envs

This time, it works by:

$ conda activate python2.7

3. Reference