Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to activate conda env with space in its name

conda env list or conda info -e shows

py35 python=3.5 as one of the environment.

How to activate conda env which has space in its name?

like image 723
Joel Avatar asked Oct 16 '25 16:10

Joel


1 Answers

tl;dr Surround the environment name with DOUBLE quotes.

@centau you can most definitely create environments with spaces in the name.

Duplicating the problem:

conda create -n "foo bar" python=3.5

Then inspecting the environments:

conda info -e

produces:

# conda environments:
#
foo bar                  C:\Users\edill\AppData\Local\Continuum\Miniconda3\envs\foo bar
root                  *  C:\Users\edill\AppData\Local\Continuum\Miniconda3

So you can see that there is an environment with the name "foo bar"

Then to activate it:

activate "foo bar"

Which modifies the command line to show:

(foo bar) C:\Users\edill>

So at this point I am reasonably confident that all is working properly with a space in the environment name, but let's just double check to make sure. Check the file that one of the built in modules is coming from:

(foo bar) C:\Users\edill>python -c "import os; print(os.__file__)"

Shows that this built in os module is indeed coming from the foo bar environment

C:\Users\edill\AppData\Local\Continuum\Miniconda3\envs\foo bar\lib\os.py
like image 52
Eric Dill Avatar answered Oct 18 '25 07:10

Eric Dill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!