I successfully created two separate Python environments in Anaconda, yet seem to be unable to activate either one of them. I have tried to read up on this topic as much as possible here on Stackoverflow, yet no solution did resolve my issue. I added information asked for by comments in this question (Anaconda Environment Doesnt activate).
When trying to activate an environment, the console output is -bash: activate: No such file or directory
.
The output of which conda
is /Users/username/anaconda3/bin/conda
.
The output of type source
is source is a shell builtin
.
When trying which activate
, the shell returns nothing.
In my bin
folder, I also seem not to have an activate
executable, but only one which is called activate-global-python-argcomplete
.
Why do I lack the standard activate file and how I could resolve this issue best?
Start a new terminal and try again. Alternatively, type
hash -r
and see if it helps.In this case, the problem might be that the virtual environment was created in
/Users/username/anaconda3/envs/
and hence the activate will be in:/Users/username/anaconda3/envs/NAME_OF_YOUR_VIRTUAL_ENV/bin/activate
Hence to activate the environment you could run:
source /Users/username/anaconda3/envs/NAME_OF_YOUR_VIRTUAL_ENV/bin/activate
My problem was that file
/opt/pycharm/plugins/terminal/.zshrc
(using ZSH) contained linesource $JEDITERM_SOURCE
. That variable contained correct paths as two parameters<path-to-anaconda-activate>/activate <path-to-anaconda>
, but apparently they got interpreted as a single parameter:<path-to-anaconda-activate>/activate <path-to-anaconda>
.I solved that prepending
eval
to that line, making iteval source $JEDITERM_SOURCE
. Now, the variable expands correctly.If you're using bash then make the same change to
/opt/pycharm/plugins/terminal/jediterm-bash.in
.tcsh was the problem for me. Changed to bash and all is ok.
I think you happened to install a buggy version of anaconda which was quickly patched.
should get you back up and running.
I experience a similar problem. In my case, the problem is related to the use of the
tcsh
, butactivate
only supportsbash
andzsh
.You can check your current used shell with the command
echo $0
.You have to use a compatible shell in order to use the
source activate
command.