Repository navigation
Debugging does not work with a conda environment #18436
Description
Issue Type: Bug
Behaviour
While debugging Python scripts, F5 or "Play button" gives no action - the only thing I see is bar with "stop", "play" and "restart" buttons - but this bar just dissapear after few seconds. In terminal no output is printed.
Since last successful debugging session no system updates or other apps were installed, VSCode is up-to-date.
I have tried restarting VSCode and restarting computer ;)
Linked with:
microsoft/vscode#142154
Expected vs. Actual
Expected: Press F5 button runs code in debug mode.
Actual: After pressing F5 button only "debug bar" appears, but code does not run at all.
Steps to reproduce:
- Open VSCode
- Open *.py file
- Press F5 or "play button" in "Run and debug" section on the left-side-bar of VSCode app window.
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": false } ] }Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.7
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Pylance
User Settings
defaultLS: {"defaultLSType":"Pylance"}
downloadLanguageServer: true
envFile: "<placeholder>"
venvPath: "<placeholder>"
venvFolders: "<placeholder>"
condaPath: "<placeholder>"
pipenvPath: "<placeholder>"
poetryPath: "<placeholder>"
languageServer: "Pylance"
linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: true
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"
sortImports
• args: "<placeholder>"
• path: "<placeholder>"
formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"
testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true
terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"
experiments
• enabled: true
• optInto: []
• optOutFrom: []
insidersChannel: "off"
tensorBoard
• logDirectory: "<placeholder>"
Extension version: 2022.0.1786462952
VS Code version: Code 1.64.0 (5554b12acf27056905806867f251c859323ff7e9, 2022-02-03T04:22:20.678Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (8 x 1800) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 15.90GB (8.45GB free) |
| Process Argv | --folder-uri file:///c%3A/Users/Pawe%C5%82%20Fic/Documents/MOLOS.ANALYTICS/Packages/trend_analysis --crash-reporter-id b5861c78-63a8-433f-adf7-5b3b6a81c16d |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392cf:30425750
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30433059
pythonvs932:30410667
vscop940:30404999
vsrem710cf:30416617
Activity
ajrock commentedon Feb 4, 2022
Having the same problem since the update to v2022.0.1786462952
rincewound commentedon Feb 4, 2022
Same over here. Worked fine yesterday. Got up to VSCode update and it no longer works. The extension seems not to be able to start the debuggee. Before it was broken, one could see the commandline passed to the pyhon interpreter in the terminal of VScode. This no longer happens.
changliufau commentedon Feb 4, 2022
Also same for me.
Temporarily solved by reloading python IntelliSense to version v2021.12.1559732655.
knoffelcut commentedon Feb 4, 2022
Same for me, specifically when using a Conda environment inside a docker container. When using the System interpreter (both host's and docker container's) it works fine.
Had to install 2021.12.1559732655 inside the docker container's vscode to fix it.
mlamarre commentedon Feb 4, 2022
++same
The Python Debug Console doesn't pop-up like it used to. console=integratedConsole doesn't help.
XinzeZhang commentedon Feb 4, 2022
++same
liaohaofu commentedon Feb 4, 2022
Same here. This happens only with Conda environment - the other interpreters work fine.
brettcannon commentedon Feb 4, 2022
Is anyone not a conda user?
For those that are using conda, this is probably because of https://devblogs.microsoft.com/python/python-in-visual-studio-code-february-2022-release/#improvements-when-using-anaconda . We thought we had this working but apparently there's at least some underlying issue. While we take a look to solve this please feel free to roll back to the 2020.12 release for now and subscribe to this issue to know when we have resolved the problem.
[-] Debugging does not work at all[/-][+] Debugging does not work with a conda environment[/+]karthiknadig commentedon Feb 4, 2022
Can some ones share how you created conda environment? Did you use
conda create -n env_nameorconda create -n env_name pythonAre you seeing anything in the terminal when the debugger starts? or the debugger is failing to start entirely? Is there in thing in the Output>Python logs that you can share that might help with this issue?
31 remaining items
NLCharles commentedon Feb 8, 2022
Another workaround is to set a symbolic link to conda env's python interpreter, and add this as a 'new' python interpreter, and debug process will start to work, without conda environment activated, which could be done manually after python debug console pops up. This requires no changes in your conda environment.
Like
I believe this is a strong indication that new launcher doesn't work with old conda.
Update:
Running
will solve environment inconsistency and repair broken conda environment (especially envs messed up by pip), and after conda update the debugger works.
phuongnm94 commentedon Feb 8, 2022
I updated conda to 4.11, but the problem has not been solved, however degrading the python extension into 2021.12.1559732655 worked with me.
amarvin commentedon Feb 8, 2022
Worked for me after degrading the python extension into 2021.12.1559732655, even with
conda4.6.14karthiknadig commentedon Feb 8, 2022
We just published a fix for the older versions of conda. The fix is in version
2022.0.1814523869.If you are in a newer version of conda and are experiencing issues, please check the error reported by conda here https://github.com/conda/conda/issues.
you can use the command in the linked comment to run the debugger from a terminal to test if it is working as expected:
#18436 (comment)
ABotond commentedon Feb 8, 2022
The problem still persists for me using VS Code 1.64.1, extension version v2022.0.1814523869 and conda 4.9.1, while using it in SSH remote mode.
It works correctly with v2021.12.1559732655.
karthiknadig commentedon Feb 8, 2022
Botond Fazekas (@ABotond) Can you try the steps here in the terminal to see if the debugger is able to start in your environment? #18436 (comment)
ABotond commentedon Feb 8, 2022
Karthik Nadig (@karthiknadig) Thanks for the quick answer. Indeed, the problem lies here somewhere:
Oh, and I'm using conda version 4.9.2, not 4.9.1.
I'm connecting to a docker image (based on pytorch/pytorch:1.8.1-cuda11.1-cudnn8-devel) running an ssh server. I can provide a minimal Dockerfile if needed.
amarvin commentedon Feb 8, 2022
Awesome job! This new version of the Python extension works for me.
karthiknadig commentedon Feb 8, 2022
Botond Fazekas (@ABotond) You are running into this issue conda/conda#10690 . Please give conda directory write permissions, and it should work. Up vote the conda issue so this gets resolved by them.
ABotond commentedon Feb 8, 2022
Karthik Nadig (@karthiknadig) what an ugly hack. But that was it, thanks a lot for your help!
Raphael-Hao commentedon Feb 9, 2022
In my case, the formatter does not work, even if I upgrade conda to
4.11and the extension to2022.0.1814523869. If I downgrade the Python extension to v2021.12.1559732655, it works.To be specific, I am using a miniconda python installed by pyenv.
When directly executing the formatting command in the terminal, which is presented in the python output window, the output is as follows.
brettcannon commentedon Feb 9, 2022
Weihao Cui (@Raphael-Hao) please open a separate issue as that's not related to debugging.
millnerryan commentedon Feb 21, 2022
I had the same issue, and had nothing to do with the extension version, only with my Conda version. I upgraded conda from 4.10 to 4.11, and even with the latest version of VS Code Python (v2022.0.1814523869), it now works.