Closed Smixi closed 2 years ago
The Python interpreter that is used to spawn the launcher is not necessarily the same that'll be used by the launcher to spawn your code - but that mismatch shouldn't be a problem.
Note that the "python" property should generally not be used to pick a different environment - you should be using the Python environment selector in VSCode instead, which takes care of things such as virtualenv activation. The property is provided mainly for advanced scenarios such as custom and embedded interpreters.
@karthiknadig, is there any way to specify the environment per-config (i.e. override the global selector)? If not, it might be a useful feature to have; but it'd have to be done on VSCode side, performing activation and rewriting "python" as needed.
The Python interpreter that is used to spawn the launcher is not necessarily the same that'll be used by the launcher to spawn your code - but that mismatch shouldn't be a problem.
Oh ok, I thought that it was the one that was executing my code.
Note that the "python" property should generally not be used to pick a different environment - you should be using the Python environment selector in VSCode instead, which takes care of things such as virtualenv activation. The property is provided mainly for advanced scenarios such as custom and embedded interpreters.
I agree, but my use case was that I'm starting compound configuration, where each config, because they are differents service with different requirements.txt file, have differents venv. I'm currently thinking if it was working before or just by luck that all requirements where somehow fullfilled on each services.
Thanks :).
If only one of those needs activation to work properly (this is usually the case for conda), it might be that you had that one selected in the Environments drop-down.
@int19h Why was this issue closed? I have the similar requirement as the OP but need to run the entire compound and I cannot find a way to do it. This is the only thing blocking from migrating to VSCode completely from PyCharm.
It was closed because the behavior as described in the original issue is by design when it comes to debugpy. To summarize, you can use "python" to specify the interpreter to run, overriding whatever was selected by the client (such as e.g. VSCode). But debugpy does not and cannot handle environment activation in the terminal that the client owns, which is why this method may not work with venvs.
This is not to imply that the scenario is invalid! It's just something that needs to be handled in the same place that normally handles Python environments and their activation, which is the VSCode Python extension. We can move this issue over there, but it focuses too much on the specific debugpy setting. It might be better to file a new issue in https://github.com/microsoft/vscode-python laying out the high-level scenario, and then we can discuss what the best VSCode UX to accommodate it would be.
Alright, got it. Thank you.
Issue Type: Bug
Behaviour
Expected vs. Actual
Specifying python interpreter in launch.json doesn't work on all configurations. Example :
Steps to reproduce:
Command launched by vscode output:
For one workspace, it launch almost all service with its own environment (one config is using virtualenv that is not the one specified), for this workspace nothing works. If I source on each integrated terminal, it does work. This was working properly before (something like a week ago).
Diagnostic data
python.languageServer
setting: DefaultUser Settings
``` defaultLS: {"defaultLSType":"Pylance"} downloadLanguageServer: true envFile: ""
venvPath: ""
venvFolders: ""
condaPath: ""
pipenvPath: ""
poetryPath: ""
languageServer: "Pylance"
linting
• enabled: true
• cwd: ""
• Flake8Args: ""
• flake8Enabled: false
• flake8Path: ""
• lintOnSave: true
• banditArgs: ""
• banditEnabled: false
• banditPath: ""
• mypyArgs: ""
• mypyEnabled: false
• mypyPath: ""
• pycodestyleArgs: ""
• pycodestyleEnabled: false
• pycodestylePath: ""
• prospectorArgs: ""
• prospectorEnabled: false
• prospectorPath: ""
• pydocstyleArgs: ""
• pydocstyleEnabled: false
• pydocstylePath: ""
• pylamaArgs: ""
• pylamaEnabled: false
• pylamaPath: ""
• pylintArgs: ""
• pylintPath: ""
sortImports
• args: ""
• path: ""
formatting
• autopep8Args: ""
• autopep8Path: ""
• provider: "autopep8"
• blackArgs: ""
• blackPath: ""
• yapfArgs: ""
• yapfPath: ""
testing
• cwd: ""
• debugPort: 3000
• nosetestArgs: ""
• nosetestsEnabled: undefined
• nosetestPath: ""
• promptToConfigure: true
• pytestArgs: ""
• pytestEnabled: false
• pytestPath: ""
• unittestArgs: ""
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true
terminal
• activateEnvironment: false
• executeInFileDir: ""
• launchArgs: ""
experiments
• enabled: true
• optInto: []
• optOutFrom: []
tensorBoard
• logDirectory: ""
```
Extension version: 2022.4.1 VS Code version: Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:46:01.075Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No Remote OS version: Linux x64 4.19.0-20-amd64 Remote OS version: Linux x64 4.19.0-20-amd64
System Info
|Item|Value| |---|---| |CPUs|AMD Ryzen 5 PRO 3500U w/ Radeon Vega Mobile Gfx (8 x 2096)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|6.88GB (0.68GB free)| |Process Argv|--crash-reporter-id e38c42d0-6509-4484-81c1-2d4dc9b12747| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: dev-fe| |OS|Linux x64 4.19.0-20-amd64| |CPUs|Intel(R) Xeon(R) CPU E5-2658 v4 @ 2.30GHz (2 x 2294)| |Memory (System)|7.76GB (0.99GB free)| |VM|0%| |Item|Value| |---|---| |Remote|SSH: dev-fe| |OS|Linux x64 4.19.0-20-amd64| |CPUs|Intel(R) Xeon(R) CPU E5-2658 v4 @ 2.30GHz (2 x 2294)| |Memory (System)|7.76GB (0.99GB free)| |VM|0%|
A/B Experiments
``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805:30301674 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 pythonvsnew555:30457759 vscscmwlcmt:30465135 cppdebugcf:30475217 ```Thanks in advance for your help :) Regards,