Skip to content

Support git-bash #3035

@Mmdixon

Description

@Mmdixon

Debugging python with the integrated terminal set to git-bash (C:\Program Files\Git\git-bash.exe which is an xterm, or even C:\Program Files\Git\bin\bash.exe which is an cygwin terminal) doesn't activate the environment properly.
It runs

activate MY_ENV

instead of

source activate MY_ENV

Would be nice if I could just override what the activate code is, instead of it trying to figure it out and getting it wrong.
Also, it is not clear what a workaround would be as I could turn off activation with "python.terminal.activateEnvironment": false, try to debug it, terminal pops up, it fails, run activation manually. Now at this point, if I try to run the previous command with ... .vscode\extensions\ms-python.python-2018.9.1\pythonFiles\e xperimental\ptvsd_launcher.py" PORT ... the port is already closed and no connection can be made. If I try debugging again, it will launch a new terminal, so it will have to activate again (but fails to do so properly).

Note that the conda environment itself is fine, as I can run it in the terminal manually after activation, and even the pylint tips in vscode is finding the modules in the conda environment.

Environment data

  • VS Code version: 1.28.2
  • Extension version (available under the Extensions sidebar): 2018.9.1
  • OS and version: Windows 10 1803
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.7.0 via miniconda3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: any installed in conda environment

Actual behavior

ImportError, not finding modules that only exist in the conda environment.

Expected behavior

Should debug within the conda environment.

Steps to reproduce:

User Settings:

"python.terminal.activateEnvironment": true
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

launch.json:

        {
            "name": "Python (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "cwd": "${workspaceFolder}",
            "console": "integratedTerminal"
        },
  • Make sure the python interpreter is set to the conda environment one (MY_ENV).
  • Launch the debugger.
  • See the errors (if running a python file that is importing a module that only exists in the conda environment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions