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
Specifying the Python interpreter in launch.json using the CONDA_PREFIX environment variable raises an error #158
Comments
Thanks for the issue. Pylance does not provide the debugger for python, that would be the python extension. Transferring issue there. |
According to this: https://code.visualstudio.com/docs/editor/variables-reference#_environment-variables, I believe that syntax should be supported, but the Python extension may not yet support it. |
@FSpanhel For this to work correctly, VS Code itself must be started from an activated conda environment.
|
@karthiknadig Thank you for your comment. Unfortunately, this is not what I want. I can achieve the same result by selecting the corresponding Python interpreter in VS Code using the Command Palette and However, it would be great if there is a connection between the activated environment in the integrated terminal and the debugger. I tried to achieve this by using the corresponding environment variable in launch.json. As far as I understand the documentation, this should work. And although it appears in my first post that the evaluated path to the Python interpreter is correct, something goes wrong. According to the error message, it appears that somehow the flag Can I somehow investigate what is going on? |
@FSpanhel That is kind of the problem. Since VS Code launches the debugger the way VS Code can resolve /cc @karrtikr This should work with the new environment variable API for terminal (i.e, we don't have debugger running with a non-activated python issue). Not sure if |
Okay, so the environment variables of VS Code are determined at startup and are not the environment variables of an integrated terminal that may also change? Is this somewhere documented? At least to me, reading https://code.visualstudio.com/docs/editor/variables-reference#_environment-variables does not imply such a behavior. Is there also some documentation about this new "terminal activation feature"? |
Reassigning to debugger as whether this is resolved or not is debugger related.
cc/ @karthiknadig This is all that the new terminal work ensures, it does not control how env variables are resolved. |
@paulacamargo25 Could you specify a closing comment with the reason for closing this? |
Type: Bug
The following configuration launch.json sets the Python interpreter to the Python interpreter of the activated conda environment of the integrated terminal
Wenn I activate the conda environment with the path to the Python interpreter being
/conda/envs/my_env/bin/python
and then start the debugger of this configuration, I get the following output in the terminalThis is unexpected, because the path
/conda/envs/my_env/bin/python
to the Python interpreter is correct.Moreover, I have also followed the steps described in https://code.visualstudio.com/docs/editor/variables-reference#_how-can-i-know-a-variables-actual-value to see that the value of the python field in the configuration is actually the path to the Python interpreter.
When I replace the python field in the configuration by
/conda/envs/my_env/bin/python
the debugger runs.Extension version: 2023.5.20
VS Code version: Code 1.78.0 (252e5463d60e63238250799aef7375787f68b4ee, 2023-05-03T20:09:00.748Z)
OS version: Windows_NT x64 10.0.19042
Modes:
Sandboxed: No
Remote OS version: Linux x64 4.4.0-19041-Microsoft
Remote OS version: Linux x64 3.10.0-1160.66.1.el7.x86_64
Remote OS version: Linux x64 4.4.0-19041-Microsoft
Remote OS version: Linux x64 4.4.0-19041-Microsoft
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: