I am having problems with Anaconda and Bash working together on my Windows 10 computer. I installed Anaconda, added it to the PATH variable, ran init bash. But I always get the same error when I try using the conda command, claiming it cannot find conda.exe:
conda activate my_env
bash: /cygdrive/c/Users/Bennji/anaconda3/Scripts/conda.exe: No such file or directory
I ran into the same issue last week and only solved it after deleting all my environments, and uninstalling anaconda and bash, and then reinstalling an recreating everything. So that is not a sustainable solution for me, as creating some of the environments takes quite some time. Also, I would like to understand what happened, to prevent this from reoccurring.
Additionally, the conda command works fine in cmd and powershell.
I should add that I have only a very basic understanding of all this, as I am quite new to terminals, conda, environments, and python. Any help would be greatly appreciated.
I tried with my limited knowledge to solve the issue, but didn't find a solution. The where conda command shows me the location just fine.
$ where conda
C:\Users\Bennji\anaconda3\Library\bin\conda.bat
C:\Users\Bennji\anaconda3\Scripts\conda.exe
C:\Users\Bennji\anaconda3\condabin\conda.bat
My PATH variable includes these lines at the beginning
C:\Users\Bennji\anaconda3\Scripts;
C:\Users\Bennji\anaconda3;
C:\Users\Bennji\anaconda3\Library\mingw-w64\bin;
C:\Users\Bennji\anaconda3\Library\usr\bin;
C:\Users\Bennji\anaconda3\Library\bin;
By typing $ C:/Users/Bennji/anaconda3/Scripts/conda.exe, I can run things such as init bash:
$ C:/Users/Bennji/anaconda3/Scripts/conda.exe init bash
no change C:\Users\Bennji\anaconda3\Scripts\conda.exe
no change C:\Users\Bennji\anaconda3\Scripts\conda-env.exe
no change C:\Users\Bennji\anaconda3\Scripts\conda-script.py
no change C:\Users\Bennji\anaconda3\Scripts\conda-env-script.py
no change C:\Users\Bennji\anaconda3\condabin\conda.bat
no change C:\Users\Bennji\anaconda3\Library\bin\conda.bat
no change C:\Users\Bennji\anaconda3\condabin\_conda_activate.bat
no change C:\Users\Bennji\anaconda3\condabin\rename_tmp.bat
no change C:\Users\Bennji\anaconda3\condabin\conda_auto_activate.bat
no change C:\Users\Bennji\anaconda3\condabin\conda_hook.bat
no change C:\Users\Bennji\anaconda3\Scripts\activate.bat
no change C:\Users\Bennji\anaconda3\condabin\activate.bat
no change C:\Users\Bennji\anaconda3\condabin\deactivate.bat
no change C:\Users\Bennji\anaconda3\Scripts\activate
no change C:\Users\Bennji\anaconda3\Scripts\deactivate
no change C:\Users\Bennji\anaconda3\etc\profile.d\conda.sh
no change C:\Users\Bennji\anaconda3\etc\fish\conf.d\conda.fish
no change C:\Users\Bennji\anaconda3\shell\condabin\Conda.psm1
no change C:\Users\Bennji\anaconda3\shell\condabin\conda-hook.ps1
no change C:\Users\Bennji\anaconda3\Lib\site-packages\xontrib\conda.xsh
no change C:\Users\Bennji\anaconda3\etc\profile.d\conda.csh
no change C:\Users\Bennji\.bash_profile
No action taken.
But environments still don't work as intended (yet they do work in powershell and cmd):
$ C:/Users/Bennji/anaconda3/Scripts/conda.exe activate my_env
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- cmd.exe
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
The only progress I made is from this related question: When I type "bash" into my bash terminal after opening it, it does recognize the conda command. but it still tells me to initalize my shell, yet when doing that, it yields the lines above, saying it took no action (and it also doesn't fix the issue, not even after restarting my shell). Also, why do I need to tell it to use bash all of a sudden? I didn't have to before.
Regarding Charles's comment: The type command yields the following:
$ type conda
conda is hashed (/c/Users/Bennji/anaconda3/Scripts/conda)
I'm not sure what to make of that, though. After all, conda.exe exists at the location C:/Users/Bennji/anaconda3/Scripts/