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

Debugger not activating Anaconda environments #2067

Closed
Oronis opened this issue Jun 28, 2018 · 3 comments
Closed

Debugger not activating Anaconda environments #2067

Oronis opened this issue Jun 28, 2018 · 3 comments
Assignees
Labels
area-debugging area-terminal bug Issue identified by VS Code Team member as probable bug

Comments

@Oronis
Copy link

Oronis commented Jun 28, 2018

Environment data

  • VS Code version: 1.24.1
  • Extension version (available under the Extensions sidebar): 2018.6.0
  • OS and version: Windows 10 Enterprise 1703
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 2.7.14
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: XXX

Actual behavior

Debugger is not activating the Anaconda environment before starting. I get an ImportError which is due to the conda environment not being properly activated when debugging. If I try the same file from the terminal launched via "Python: Create Terminal" it loads the environment properly and works.

ImportError: DLL load failed: The specified module could not be found.

Expected behavior

When launching a debug process against an anaconda environment, the python extension should activate the environment similar to how it works when you use the "Python: Create Terminal" or "Python: Run Python File in Terminal" commands before starting to debug.

Steps to reproduce:

  1. Open VSCode.
  2. Open the python file with import that requires loading DLLs (in this case gurobipy but I've had similar issues with opencv and other packages)
  3. Run default debug "Python: Current File"
  4. Error occurs.

Logs

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

Traceback (most recent call last):
  File "c:\Repos\Package\script.py", line 12, in <module>
    from gurobipy import *
  File "C:\Users\username\AppData\Local\Continuum\anaconda2\lib\site-packages\gurobipy\__init__.py", line 1, in <module>
    from .gurobipy import *
ImportError: DLL load failed: The specified module could not be found.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

Python Extension: Failed to get conda environment list from conda Error: spawn conda ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9)
@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug area-debugging area-terminal needs decision labels Jun 28, 2018
@DonJayamanne
Copy link

Debugger is not activating the Anaconda environment before starting.

Unfortunately today we do not activate the terminal during debugging.
We merely launch the program using the corresponding executable.

@brettcannon
Copy link
Member

I think #1387 would implicitly take care of this.

@DonJayamanne
Copy link

Confirmed it works as expected. Already got a prototype of auto-activate, just need to write tests and submit a PR.

@DonJayamanne DonJayamanne self-assigned this Sep 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging area-terminal bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants