Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the python debugger is going faster than conda activation #13711

Closed
ztibeike opened this issue Sep 1, 2020 · 3 comments
Closed

the python debugger is going faster than conda activation #13711

ztibeike opened this issue Sep 1, 2020 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@ztibeike
Copy link

ztibeike commented Sep 1, 2020

Environment data

  • VS Code version: 1.48.1 (user setup)
  • Extension version (available under the Extensions sidebar): v2020.8.105369
  • OS and version: Windows 10 v1909
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Value of the python.languageServer setting: Microsoft

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

image

Actual behaviour

image
image
XXX

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Python programming with conda virtual env, for example, I have a conda env named tf
  2. the debugger is going faster than conda activation which caused when I start the debugger at the first time, "Import Error" will be reported, since I install the module in env "tf" instead of env "base" but the debugger goes faster than conda activation, means that my python program is running in env "base" so that it can't find the target module to import.
  3. this issue will reproduce every time after I terminate the Python Debug Console
    image

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@ztibeike ztibeike added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 1, 2020
@karthiknadig karthiknadig self-assigned this Sep 1, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 1, 2020
@karthiknadig
Copy link
Member

This is a known issue with activating conda. This occurs due to some limitation we have with the VS Code. Here is a workaround for this:

  1. Turn of auto activation. To do this, disable these two settings, ideally only for the project you are working on:
    image
  2. Exit VS Code.
  3. Open Anaconda Prompt, navigate to your project.
  4. Activate the environment that you want.
  5. Run code . or code project.code-workspace to launch VS Code.

This will give you an activate environment, and the extension will not have to try and activate every time a terminal is created.

@ztibeike
Copy link
Author

ztibeike commented Sep 2, 2020

@karthiknadig Is this issue a bug? If it is, hope it can be fixed as soon as possible.

@karthiknadig
Copy link
Member

@ztibeike This is a dupe of #4203, #5664. We are trying get a common solution to various distributions and their activation mechanisms. In the case of conda, we tried conda run to avoid activating each time. But we had to revert it due to the limitations of conda run that broke debugging in other ways. For now, the workaround i mentioned above is the best way to get around this problem.

@ghost ghost removed the triage label Sep 2, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants