skip to Main Content

Normal GitBash in Windows:

[GitBash in Windows][1]
$ echo $PATH
/c/Users/Krystian/anaconda3:/c/Users/Krystian/anaconda3/Library/mingw-w64/bin:/c/Users/Krystian/anaconda3/Library/usr/bin:/c/Users/Krystian/anaconda3/Library/bin:/c/Users/Krystian/anaconda3/Scripts:/c/Users/Krystian/anaconda3/bin:/c/Users/Krystian/anaconda3/condabin:/c/Users/Krystian/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/mingw64/bin:/usr/bin:/c/Users/Krystian/bin:

Same command but in GitBash Terminal in Visual Studio Code when conda env is selected

[GitBash in VSCode][2]
$ echo $PATH
C:UsersKrystiannaconda3vsmain;C:UsersKrystiannaconda3vsmainLibrarymingw-w6in;C:UsersKrystiannaconda3vsmainLibraryusin;C:UsersKrystiannaconda3vsmainLibrarin;C:UsersKrystiannaconda3vsmainScripts;C:UsersKrystiannaconda3vsmaiin;C:UsersKrystiannaconda3/c/Users/Krystian/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/mingw64/bin:/usr/bin:

I can not execute any commannd related to conda when I’am using a GitBash in VSC.
For instance:

[Conda command](https://i.sstatic.net/EDodhQqZ.png)
$ conda deactivate

bash: C:UsersKrystiannaconda3Scripts: No such file or directory

Why GitBash doesn’t work in VSC while Anaconda Env is selected as a Python Interpreter? It looks like there is a wrong path Krystiannaconda3/ but in env setting everything is correct.

I tried to reinstall everything, respectivelly VSCode, Git, Anaconda, and still encounter this problem.

2

Answers


  1. This problem may be caused by the incompatibility between VS Code’s Git Bash terminal and Anaconda’s environment variables on Windows systems. In Git Bash, paths are used Unix-style (using forward slashes /), while Anaconda may use Windows-style paths (using backslashes ****) when setting environment variables.

    You could try to use PowerShell or CMD in VSCode.

    Another way is to manually modify the environment variable. Before starting VS Code, you can set the PATH environment variable in Git Bash by command export PATH="/c/Users/Krystian/anaconda3:/c/Users/Krystian/anaconda3/Library/mingw-w64/bin:/c/Users/Krystian/anaconda3/Library/usr/bin:/c/Users/Krystian/anaconda3/Library/bin:/c/Users/Krystian/anaconda3/Scripts:$PATH" so that it contains the correct Anaconda path.

    Login or Signup to reply.
  2. I am having a similar issue. It appears the backslashes are removing the next character if it is lowercase. I believe this started happening after a recent vs code update. I may try to roll back.

    $ conda
    bash: C:Userswilsnaconda3Scripts: No such file or directory
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search