Closed p-i- closed 2 months ago
Test case (works):
Fail case (my project):
If I click step {over/out/in} on the fail-case:
^ That's how I'm invoking debug on a cell
As a follow-up, this has hit me again.
To resolve it, I created a fresh folder, created a ./.venv, opened VSCode, copied my .ipynb and .py file into this new folder, and was able to successfully use the debugger in my .ipynb.
Then I left VSCode running and went to sleep. And now first thing in the morning, it is again failing.
I haven't done anything fancy. All I've been doing is tweaking a numpy-heavy .py file and an .ipynb that uses it. I haven't done anything else on my mac, other than watch a YouTube video in a Chrome tab.
In fact my "fresh folder" was the folder I used for my working testcase (first screenshot).
And re-executing the test now fails. On exactly the same x.ipynb file!
I've looked through all available logs in Output pane, and see no anomaly.
This is a serious problem :/
As per https://stackoverflow.com/questions/56794940/vscode-why-isnt-debugger-stopping-at-breakpoints toggling "Jupyter: Debug Just My Code" in Settings to ON has gotten it working.
Why can't I see the setting I just changed in ~/Library/Application\ Support/Code/User/settings.json
? Even after a VSCode restart it's not there. And I have no .vscode/ folder in my project. I thought every settings-change creates a new entry at the bottom of this JSON list.
Than you for filling this issues and sorry you are running into this And Thank you for your detailed analysis and screenshot
I think the final conclusion would that the settings aren’t getting saved/applied correctly.
Is that correct?
Let me clarify my last post. There's two complete separate things in it.
Toggling "Jupyter: Debug Just My Code" to ON fixes the "debugger not working correctly" issue. Now this is a bizarre fix. So the issue should be considered as a bug IMO.
After toggling this setting, I decided to inspect my User/Settings.json so that I could copy down the exact key for this setting, and was surprised to find that the setting isn't getting written to that file. I doubt this is connected to the original issue. But I am curious as to why I can't find this setting. I just checked again today and it is still not there.
as to why I can't find this setting. I just checked again today and it is still not there.
Default values aren't written into settings.json By default this value is turn on, hence you may have disabled this at some point in time.
I doubt this is connected to the original issue.
Given that you are not debugging any 3rd party code and just a simple cell and its not hitting your break point. I agree, that the setting should not really make a difference, however for now I would suggest enabling the value as that is the default value.
Please someone remove the info-needed tag.
I have the same problem, the debugger does not stop. Moreover, after I stop it, the little arrow that allows me to select "Debug Cell" disappears. Tried reverting back to previous versions, both vscode-jupyter and vscode-python extensions, nothing worked.
I've also bumped into that disappearing debug-cell option.
As I remember, closing and restarting VSCode shakes it loose.
I haven't been able to isolate a clean consistent minimal fail, so I haven't reported that oddity yet.
There are still quite a few quirks with running .ipynbs in VSCode. I wish they had someone on the team that uses .ipynbs a lot -- they would surely bump into these frustration points.
Or even a Discord where if some engineer hits such a problem, a core-dev could remote-inspect their system over screenlink. I'd be more than happy to allow a core-dev to dig around in my box if it would lead to a seamless UX.
This is not the only issue I face. After stopping the debugger (because it does not stop) and relaunching it, I get the error "Couldn't find a debug adapter for debug type python". This started occurring after the last update of VSCode/Python extension. I tried downgrading everything, the problem persists.
@edervishaj Did you try deleting and re-creating your Python .venv? It might be possible that it is corrupted somehow.
@edervishaj Did you try deleting and re-creating your Python .venv? It might be possible that it is corrupted somehow.
I created a new environment altogether, did not help at all. The debugger stops but after the first step over it throws the above error.
After toggling this setting, I decided to inspect my User/Settings.json so that I could copy down the exact key for this setting, and was surprised to find that the setting isn't getting written to that file. I doubt this is connected to the original issue. But I am curious as to why I can't find this setting. I just checked again today and it is still not there.
@p-i- Please can you create a separate issue for this, then we can close this. Also, when creating a new issue, please can you create the issue in the VS Code repo, as thats un-related to Jupyter extension (its a functionality provided by VS Code itself)
This is not the only issue I face. After stopping the debugger (because it does not stop) and relaunching it, I get the error "Couldn't find a debug adapter for debug type python". This started occurring after the last update of VSCode/Python extension. I tried downgrading everything, the problem persists.
@edervishaj Please can you create a new issue and please do share the following logs in that new issue Please could you enable logging as follows:
Jupyter->Logging
trace
Jupyter
output panel (use the command Jupyter: Show Output
to get to the logs).
Type: Bug
TLDR (Edited 9 Aug)
In my case the problem was fixed by toggling "Jupyter: Debug Just My Code" in Settings to ON.
Original message ...
I have VSCode opened in $root. I have $root/.venv/... (Python 3.12.3, freshly installed using pyenv (macos))
I create test.ipynb
First cell:
a = 1
, Second cell:b = 2
. I execute the first cell. ok. I set a breakpoint on the first (and only) line of the second cell and debug-execute it.There's no visual indication the breakpoint has been hit. And attempting to step-{in/out/over} lands me in alien code (see screenshot).
Now I try to create a fresh test case. Quit VSCode, create test/ folder, create test/.venv/ (from pyenv, identically as done per fail-case), open VSCode in test/, create x.ipynb, 2 cells
a = 2
andb = 2
, execute the first. ok. set breakpoint on second and debug-execute the second.It hits! It works!
So something in my $root project is mashing the debugger.
This is bizarre and frustrating. It means I'm going to have to copy my entire codebase into a fresh project just to get the debugger working in .ipynb files.
Extension version: 2024.7.0 VS Code version: Code 1.92.0 (b1c0a14de1414fcdaa400695b4db1c0799bc3124, 2024-07-31T23:26:45.634Z) OS version: Darwin arm64 23.5.0 Modes:
System Info
|Item|Value| |---|---| |CPUs|Apple M2 (8 x 2400)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: enabled_on
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|3, 3, 2| |Memory (System)|24.00GB (2.33GB free)| |Process Argv|--crash-reporter-id f10d97cd-2115-4dba-a34a-07be9312995a| |Screen Reader|no| |VM|0%|
A/B Experiments
``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 refactort:31108082 ccplc:31103425 pythonrstrctxt:31103193 wkspc-onlycs-c:31106320 wkspc-ranged-c:31107834 ```