4

I'm new to the Conda environment and I was trying to create an environment by conda create -n chip python=2.7, and then source activate chip to activate the environment, but then I got the error message:

Could not find conda environment: chip
You can list all discoverable environments with `conda info --envs`.

And conda info --envs returned me:

# conda environments:
#
base                  *  /Users/yin/miniconda3
                         /anaconda3
                         /anaconda3/envs/chip

I tried source activate /anaconda3/envs/chip and it worked.
So can I add a name to my new environment (e.g. chip) so that I can activate it without typing the full path?
Thank you!

Yin
  • 43
  • 3

2 Answers2

1

Rather than moving the environment around (which can cause issues), a better solution is to add the envs folder to the envs_dirs key-value list in .condarc, e.g.:

ssl_verify: true
channels:
  - defaults
envs_dirs:
  - C:\Users\<user>\Anaconda3\envs
  - D:\envs

Then all the environments will be available by their aliases in addition to their full paths. Answer shamelessly stolen from https://stackoverflow.com/a/56903431/1284670.

Guillochon
  • 902
  • 1
  • 10
  • 21
-1

How many conda installations do you have and how did you create the chip environment? Based on your output the path for the conda executable is pointing to the conda installation in /Users/yin/miniconda3 and it may not know about environments installed in other directory trees.

When you create a conda environment using conda create -n chip it should be created in the envs sub-directory of where your conda distribution is installed, i.e., /Users/yin/miniconda3/envs/chip. Then you can refer to the environment by its name, i.e., source activate chip.

When you create a conda environment using conda create -p the_env_path it will be created in the_env_path and you will have to refer to it by its path when using activate.

jeschwar
  • 1,286
  • 7
  • 10
  • Thanks for the answer. I think I used `conda create -n chip` but I might type something differently by accident. I tried `conda create -n chip` again to create a new environment and I could access it without typing the full path. So now can I move the `chip` to `/Users/yin/miniconda3/envs/chip` or do anything else to solve this problem? – Yin Nov 30 '18 at 23:53
  • I ended up creating a new environment and moving everything into that environment and it worked. – Yin Dec 02 '18 at 22:02
  • @Yin Good to hear. If you have found this response helpful please mark as "accepted answer". – jeschwar Dec 03 '18 at 16:12