Skip to content

Slashes not escaped in paths when activating conda environments in Git Bash on Windows #11419

Closed
@keithyipkw

Description

@keithyipkw

Upon opening a new Bash,

$ C:\ProgramData\Anaconda3\Scripts\activate mkl
bash: C:ProgramDataAnaconda3Scriptsactivate: command not found

The correct command should be using escaped backslashes or forward slashes

$ C:\\ProgramData\\Anaconda3\\Scripts\\activate mkl
$ C:/ProgramData/Anaconda3/Scripts/activate mkl

Interestingly, the command for activating the base environment is

$ C:/ProgramData/Anaconda3/Scripts/activate

Environment data

  • VS Code version: 1.44.2
  • Extension version (available under the Extensions sidebar): 2020.4.74986
  • OS and version: Windows_NT x64 10.0.18362
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda 4.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: all
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): true
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

The environment is activated.

Actual behaviour

"command not found" is displayed.

Steps to reproduce:

  1. Ensure python.terminal.activateEnvironment to be true
  2. Select an Anaconda environment other than the base
  3. Open a new terminal

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

Activating environments other than the base

workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:14: getActivatedEnvironmentVariables, Class name = _, completed in 381ms, has a truthy return value, Arg 1: undefined
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Shell path 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Shell path identified as shell 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Terminal name 'bash' identified as shell 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: [object Object]. Shell identified as bash (Terminal name is bash)
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Shell identified as 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Get Conda environments, Class name = b, completed in 0ms, has a truthy return value, Arg 1: false, Return Value: [{"name":"base","path":"C:\\ProgramData\\Anaconda3"},{"name":"mkl","path":"C:\\Users\\user\\.conda\\envs\\mkl"},{"name":"py2","path":"C:\\Users\\user\\.conda\\envs\\py2"},{"name":"py27_32","path":"C:\\Users\\user\\.conda\\envs\\py27_32"}]
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Cached data exists KeyPrefix=Cache_Method_Output_b.getCondaVersion-Args=
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Cached data exists KeyPrefix=Cache_Method_Output_b.getCondaFileFromInterpreter-Args="C:\\Users\\user\\.conda\\envs\\mkl\\python.exe"-Arg-Separator-"mkl"
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:04:18: Get Conda File from interpreter, Class name = b, completed in 0ms, has a falsy return value, Arg 1: "C:\\Users\\user\\.conda\\envs\\mkl\\python.exe", Arg 2: "mkl", Return Value: undefined

Activiting the base

workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Shell path 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Shell path identified as shell 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Terminal name 'bash' identified as shell 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: [object Object]. Shell identified as bash (Terminal name is bash)
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Shell identified as 'bash'
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Get Conda environments, Class name = b, completed in 0ms, has a truthy return value, Arg 1: false, Return Value: [{"name":"base","path":"C:\\ProgramData\\Anaconda3"},{"name":"mkl","path":"C:\\Users\\user\\.conda\\envs\\mkl"},{"name":"py2","path":"C:\\Users\\user\\.conda\\envs\\py2"},{"name":"py27_32","path":"C:\\Users\\user\\.conda\\envs\\py27_32"}]
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Cached data exists KeyPrefix=Cache_Method_Output_b.getCondaVersion-Args=
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Cached data exists KeyPrefix=Cache_Method_Output_b.getCondaFileFromInterpreter-Args="C:\\ProgramData\\Anaconda3\\python.exe"-Arg-Separator-"base"
workbench.desktop.main.js:sourcemap:262 [Extension Host] Info Python Extension: 2020-04-26 15:07:35: Get Conda File from interpreter, Class name = b, completed in 0ms, has a truthy return value, Arg 1: "C:\\ProgramData\\Anaconda3\\python.exe", Arg 2: "base", Return Value: "C:\\ProgramData\\Anaconda3\\Scripts\\conda.exe"

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions