microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.57k stars 29.01k forks source link

Debug Cell option disappears #150219

Open wcneill opened 2 years ago

wcneill commented 2 years ago

Environment data

Expected behavior

A small drop down arrow next to the run cell, which shows a debug cell option: image

Actual behavior

The drop down arrow disappears after a single debug run, and using the ctrl + shift + alt + enter to key combo to debug the cell is also unresponsive. Sometimes it comes back in a few minutes of waiting and sometimes I have to restart VS Code.

image

Steps to reproduce:

  1. Start a notebook
  2. Debug a cell
  3. The down arrow disappears.

Logs

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

``` XXX ```

vscodenpa commented 2 years ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.67.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

MaxHellstrom commented 2 years ago

This issue remains in 1.67.2.

TimotheeWright commented 2 years ago

I've been experimenting this issue the last few days. Happens every time if you stop the run during debugging but also at some other times

RoelRotti commented 2 years ago

Same, have had this issue quite a lot over the past months

MaxHellstrom commented 2 years ago

For me, the drop-down arrow reappears after scrolling further down in the notebook, and then back up to the cell.

greazer commented 2 years ago

nb-golden because it can block debugging from working altogether. At least seems that way.

roblourens commented 2 years ago

I've not seen this and can't repro. It's possible that https://github.com/microsoft/vscode-jupyter/issues/10595 could help.

This comment

For me, the drop-down arrow reappears after scrolling further down in the notebook, and then back up to the cell.

point at something in vscode, but knowing how we manage context with the menu, I haven't seen an issue like this and am not sure what could cause it.

mariuswallraff commented 2 years ago

I encountered the same issue multiple times, most recently just right now, using version 1.68.1.
Scrolling up and down frantically did not resolve the issue, unfortunately.

EDIT: Maybe helpful: While Shift+Return still works for executing, Ctrl+Return stopped working at (about?) the same time as the debug drop-down disappeared, so this might be correlated.

roblourens commented 2 years ago

Things that would be helpful:

roy651 commented 2 years ago

Having same issue on 1.68.1. Intermittent but usually happens after a debug crash. Scrolling doesn't help but running some other cell usually brings back the fantom debug option. In one worse case where it didn't reappear - only a restart of vscode worked.

smericks commented 2 years ago

Having the same issue on version 1.70.2.

carschno commented 1 year ago

I am facing the same issue on version 1.72.2 on Mac OS. However, this seems to happen only when I have opened the file in multiple tabs (in different groups). In one of them (the one I opened last in my case), the drop down arrow giving access to the debug function remains available and works.

This is not an exact analysis and hard to reproduce, but perhaps this individual report helps.

Version details:

Version: 1.72.2 (Universal) Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075 Date: 2022-10-12T22:16:30.254Z (3 wks ago) Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin arm64 22.1.0 Sandboxed: No

Karlheinzniebuhr commented 1 year ago

Same issue, latest VSCode on Win10

himra13 commented 1 year ago

Facing the same issue on mac os

jupyter version: v2022.11.1003412109

For me, It happens after my debugger crash and I force close the debugger.

  1. Try restarting the notebook doesn't work.
  2. Restarting vscode could solve the problem
roblourens commented 1 year ago

I'll say it again

Things that would be helpful:

kodecreer commented 1 year ago

I am having the same exact issue as above but it's on a Mac M1 on the latest OS. Same as @himra13 is saying

Jonatthu commented 1 year ago

I am having exactly the same issue on Mac M1 Max

IgorReidler commented 1 year ago

Same issue on Windows 11 with VSCode 1.74.3 Restart Visual Studio Code resolves temporarily.

notgwilym commented 1 year ago

Exact same issue on Macbook Air M1 (2020)

jtsilverio commented 1 year ago

I'll say it again

Things that would be helpful:

* F1 > "Set log level" > Trace

* Set `"jupyter.logging.level": "verbose"`

* Repro the issue (even if you just do this after you are already in the broken state, it may still be helpful)

* Share the logs from the `Log (Window)` and `Jupyter` output channels

Where are the logs stored? I enable the verbose logging but can't find the log files.

makovez commented 1 year ago

same issue with windows

nicosquare commented 1 year ago

Hi!

The issue is still happening in Ubuntu. My version is:

Version: 1.76.0 Commit: 92da9481c0904c6adfe372c12da3b7748d74bdcb Date: 2023-03-01T10:25:16.105Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Linux x64 5.19.0-35-generic Sandboxed: No

Thanks for any help. This issue needs to be solved and is a source of time waste.

lalvarez3 commented 1 year ago

Still happening in Windows and MacOS. It really makes the debug feature on notebooks very tedious to use.

Thomasjurriaans commented 1 year ago

Still happening on Ubuntu too, makes using VScode very frustrating...

sunovivid commented 1 year ago

Same problem.

If you are using a remote extension, it would be more convenient to press Ctrl + Shift + P to display the command palette and type "reload window".

In my case, this problem appeared when the kernel was corrupted by something (in my case, debug failure).

Karlheinzniebuhr commented 1 year ago

Same issue on Windows 10, this has been an issue for months btw

fzouari commented 1 year ago

I am facing the same issue, here is a traceback of the issue:

`

UnboundLocalError Traceback (most recent call last) (.venv) MYPC RepoName % /usr/bin/env /path/to/RepoName/.venv/bin/python /path/to/.vscode/extensions/ms-python.python-2023.8.0/ pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 55558 -- /path/to/RepoName/path/to/notebook.ipynb Traceback (most recent call last): File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/path/to/RepoName/path/to/notebook.ipynb", line 245, in "execution_count": null, NameError: name 'null' is not defined (.venv) MyPC % cd /path/to/RepoName ; /path/to/RepoName/.venv/bin/python /path/to/.v scode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 55592 -- /path/to/RepoName/path/to/notebook.ipynb Traceback (most recent call last): File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/path/to/.vscode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/path/to/RepoName/path/to/notebook.ipynb", line 245, in "execution_count": null, NameError: name 'null' is not defined (.venv) MyPC RepoName % cd /path/to/RepoName ; /usr/bin/env /path/to/RepoName/.venv/bin/python /path/to/.v scode/extensions/ms-python.python-2023.8.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 55602 -- /path/to/RepoName/path/to/notebook.ipynb `

dorienh commented 1 year ago

Same issue on OS 13.x

Haagimus commented 1 year ago

I am also experiencing this issue on a Win10 enterprise system: VSCode: 1.80.0

For those affected a surefire way to fix this is to reload the window using the Developer: Reload Window option from the command prompt (ctrl+shift+p, or bind it to a hotkey). image

This will reset your entire environment so you will have to rerun any previous cells for processed data again but, this works for me 100% of the time.

starball5 commented 1 year ago

Related(?) on Stack Overflow: VS Code Debug Cell disappears arbitrarily in Jupyter Notebook view

copperwiring commented 1 year ago

Same issue. Develper:reaload window is not very convenient since a previous cell might have heavy data processing and I dont want to repreat again an again :(

Haagimus commented 1 year ago

Same issue. Develper:reaload window is not very convenient since a previous cell might have heavy data processing and I dont want to repreat again an again :(

I 100% agree with you on this one, it is not very ideal. I am only working with files in low gb size so reloading is not too inconvenient but, I totally feel your pain on that one. It is such an annoying issue.

JinYuannn commented 1 year ago

same issue. version: 1.81.1 still not fixed

jtsilverio commented 1 year ago

I'll say it again

Things that would be helpful:

  • F1 > "Set log level" > Trace
  • Set "jupyter.logging.level": "verbose"
  • Repro the issue (even if you just do this after you are already in the broken state, it may still be helpful)
  • Share the logs from the Log (Window) and Jupyter output channels

Ok, after bumping into this error again I have found the log window.

Here is the output:

window log
---
2023-08-23 10:50:48.341 [trace] CommandService#executeCommand workbench.output.action.clearOutput
2023-08-23 10:50:48.441 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.621 [trace] CommandService#executeCommand jupyter.runAndDebugCell
2023-08-23 10:50:52.622 [trace] onWillActivateByEvent:  onCommand:jupyter.runAndDebugCell
2023-08-23 10:50:52.633 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.637 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.642 [trace] onWillActivateByEvent:  onDebugResolve
2023-08-23 10:50:52.642 [trace] onWillActivateByEvent:  onDebugResolve:Python Kernel Debug Adapter
2023-08-23 10:50:52.667 [trace] MainThreadTreeViews#$registerTreeViewDataProvider pythonDebugImageWatch {"showCollapseAll":false,"canSelectMany":false,"dropMimeTypes":[],"dragMimeTypes":[],"hasHandleDrag":false,"hasHandleDrop":false,"manuallyManageCheckboxes":false}
2023-08-23 10:50:52.679 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.680 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.681 [trace] CommandService#executeCommand _setContext
2023-08-23 10:50:52.689 [trace] CommandService#executeCommand _setContext
2023-08-23 10:51:03.125 [trace] CommandService#executeCommand _setContext
2023-08-23 10:51:03.130 [trace] DialogService#prompt 
2023-08-23 10:51:03.417 [trace] CommandService#executeCommand _setContext
2023-08-23 10:51:03.418 [trace] CommandService#executeCommand _setContext
2023-08-23 10:51:05.137 [trace] MainThreadTreeViews#$refresh pythonDebugImageWatch undefined
2023-08-23 10:51:16.443 [trace] CommandService#executeCommand _setContext
2023-08-23 10:51:16.443 [trace] CommandService#executeCommand _setContext
Jupyter log
---
11:32:53.762 [info] Starting debugging with mode 1
11:32:53.765 [debug] Executing silently Code (idle) = import builtins\nimport ipykernel\nbuiltins.print(ipykernel.__version__)
11:32:53.773 [debug] Executing silently Code (completed) = import builtins\nimport ipykernel\nbuiltins.print(ipykernel.__version__) with 1 output(s)
11:32:53.855 [debug] [Debug] to kernel: {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"Python Kernel Debug Adapter","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true},"type":"request","seq":1}
11:32:53.855 [debug] [Debug] to kernel, mapped: {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"Python Kernel Debug Adapter","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true},"type":"request","seq":1}
11:32:53.924 [debug] KernelProcess error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/__main__.py", line 215, in <module>
    __import__("debugpy")
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 35, in <module>
    from debugpy.public_api import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 8, in <module>
    import typing
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../typing.py", line 1007, in __new__

11:32:53.925 [warn] StdErr from Kernel Process Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/__main__.py", line 215, in <module>
    __import__("debugpy")
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 35, in <module>
    from debugpy.public_api import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 8, in <module>
    import typing
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "~/project/venv/lib/python3.11/site-packages/debugpy/adapter/../../typing.py", line 1007, in __new__
11:32:53.925 [debug] KernelProcess error:     self._abc_registry = extra._abc_registry
                         ^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Callable' has no attribute '_abc_registry'

11:32:53.925 [warn] StdErr from Kernel Process self._abc_registry = extra._abc_registry
                         ^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Callable' has no attribute '_abc_registry'
.vscode/launch.json
---
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        }
    ]
}
jtsilverio commented 1 year ago

Other info:

jtsilverio commented 1 year ago

Other info:

I am able to debug the notebook cells if I open the .ipynb as a file. The error described above happens when I open the project folder that contains the notebook I am working with.

Deleting the project's venv and recreating it fixed the problem.

yuxudong20 commented 1 year ago

i got the same issue, and i find that switching to another virtual environment fixes my problem. However, i still don't know why, the problem still exists in the original conda environment.

yuxudong20 commented 1 year ago

I have a try: removing the module 'Typing' seems to work for the original env.

jtsilverio commented 1 year ago

I have a try: removing the module 'Typing' seems to work for the original env.

Yeah, I had the same bug again and uninstalling the typing package also fixed it.

JohnAtl commented 1 year ago

I don't use Typing, and still have this problem. I use conda/pip to manage environments.

balexandermunoz commented 1 year ago

Same issue here. VScode version: 1.82.3 Python version: 3.11 OS: Windows_NT x64 10

tkreuder commented 12 months ago

%pip uninstall typing -y fixed it for me as well. 🤷‍♂️

newco-inuru commented 11 months ago

For me the dropdown arrow is gone, after running the cell in debug mode once, but I'm still able to use ctrl + shift + alt + enter to run the cell in debug mode, which is interesting..

gcem commented 11 months ago

I had this message in jupyter-notebook logs:

[IPKernelApp] WARNING | debugpy_stream undefined, debugging will not be enabled

Installing the python-debugpy package fixed the issue for me.

guptadivyansh commented 11 months ago

I don't have this issue anymore with version 1.83.1 of VSCode.

poedator commented 11 months ago

same problem observed on Mac OS with VSCode version: 1.84.2 no typing is installed ( will try to update this msg with trace.

nicosan-eos commented 9 months ago

Same issue in Windows 11 VSCode 1.85.1.

Streep commented 9 months ago

Issues also still present for me in 1.85.1. If I understand correctly the notebook debug functionality is provided by the Jupyter extension https://github.com/microsoft/vscode-jupyter, because that is where the necessary debug functionality is implemented. In that repo I do not see any specific issue listed, perhaps maybe this one, which links the issue to the presence of the typings module.

Jynxzzz commented 8 months ago

Same issue in macos VSCode 1.86.2

Hungryarie commented 7 months ago

For me as well. It does work at the start, but than after some time it stops working (presumably after some sequence of events that I am not yet aware off). Windows 10 VS code 1.84.2