Skip to content
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

Jupyter notebook debugger stuck and prompt "open 'launch.json' " window #15562

Closed
1 of 2 tasks
flyforwardFast opened this issue Apr 17, 2024 · 5 comments
Closed
1 of 2 tasks
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@flyforwardFast
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

I tried to use the Jupyter Notebook within VSCode. However, when I click on debug bottom, the debugger just got stuck and after a min or so, it prompted Open "launch.json" window. Then the debug function by the jupyter cell disappeared.

This seems like a generic issue to me. You can reproduce with any code, such as below:
`import pandas as pd

Sample data

data = {
    'name': ['A', 'A', 'B', 'B', 'C', 'C'],
    'var_1': [1, 2, 3, 4, 5, 6],
    'var_2': [6, 5, 4, 3, 2, 1]
}
df = pd.DataFrame(da`

I tried Python v2024.4.1 Extension with Jupyter v2024.4.2024041101 (pre-release) and v2024.3.1

Screen shot

Pasted Graphic 2 Open 'launch json' import pandas as pd

VS Code Version

Version: 1.88.1 (Universal) Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:42:52.765Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.4.0

Jupyter Extension Version

v2024.4.2024041101 (pre-release)

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.8.8

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

None

@flyforwardFast flyforwardFast added the bug Issue identified by VS Code Team member as probable bug label Apr 17, 2024
@VSCodeTriageBot VSCodeTriageBot added the triage-needed Issue needs to be triaged label Apr 17, 2024
@DonJayamanne
Copy link
Contributor

Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to verbose
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel.

Also do you have the Python Debugger extension installed?

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster and removed triage-needed Issue needs to be triaged labels Apr 17, 2024
@flyforwardFast
Copy link
Author

flyforwardFast commented Apr 18, 2024

Hi Don, Thanks for your suggestion. I did installed Python Debugger as I can debug into.pywithout any issues.

Below is the output:

Show Logs

`Visual Studio Code (1.88.1, undefined, desktop)
Jupyter Extension Version: 2024.4.2024041101.
Python Extension Version: 2024.4.1.
Pylance Extension Version: 2024.4.1.
Platform: darwin (arm64).
No workspace folder opened.
16:56:22.520 [debug] Start refreshing Kernel Picker (1713398182520)
16:56:22.526 [debug] Get Custom Env Variables, Class name = qm, completed in 6ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
16:56:22.527 [debug] Jupyter Paths /kernels: 
16:56:22.527 [debug] Kernel Spec Root Paths, /usr/share/jupyter/kernels, /usr/local/share/jupyter/kernels, ~/Library/Jupyter/kernels
16:56:22.554 [debug] End refreshing Kernel Picker (1713398182520)
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /usr/bin/python3
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/EEG_Attn/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/Rindo/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/baltic/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/bolt/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/hercules/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/interlinked/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/klogin/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/labpepper/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/mb_3/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/pytorch/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/pytorch_m3/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/tf_m3/bin/python
16:56:22.571 [debug] Search for KernelSpecs in Interpreter /opt/miniconda3/envs/vax_test/bin/python
16:56:22.571 [debug] Start refreshing Kernel Picker (1713398182571)
16:56:22.689 [debug] KernelProvider switched kernel to id = .jvsc74a57bd087998d4b2a08f200e53bd85c2d7b01bf2b69127f748e5c1e9a18138bae014c82./opt/miniconda3/envs/pytorch/python./opt/miniconda3/envs/pytorch/python.-m#ipykernel_launcher
16:56:22.689 [debug] start the kernel, options.disableUI=true for ~/Desktop/Untitled-1.ipynb
16:56:22.693 [debug] Registering commtarget jupyter.widget
16:56:22.693 [debug] Controller selection change completed
16:56:22.700 [debug] Get Custom Env Variables, Class name = qm, completed in 0ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
16:56:22.700 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd087998d4b2a08f200e53bd85c2d7b01bf2b69127f748e5c1e9a18138bae014c82./opt/miniconda3/envs/pytorch/python./opt/miniconda3/envs/pytorch/python.-m#ipykernel_launcher  (Python Path: /opt/miniconda3/envs/pytorch/bin/python, Conda, pytorch (Python 3.8.18), 3.8.18) for '~/Desktop/Untitled-1.ipynb' (disableUI=true)
16:56:22.700 [debug] Creating raw notebook for resource '~/Desktop/Untitled-1.ipynb'
16:56:22.704 [debug] Get Custom Env Variables, Class name = qm, completed in 1ms, has a truthy return value, Arg 1: "~/Desktop/Untitled-1.ipynb", Arg 2: "RunPythonCode"
16:56:22.713 [debug] End refreshing Kernel Picker (1713398182571)
16:56:22.722 [debug] Launching kernel .jvsc74a57bd087998d4b2a08f200e53bd85c2d7b01bf2b69127f748e5c1e9a18138bae014c82./opt/miniconda3/envs/pytorch/python./opt/miniconda3/envs/pytorch/python.-m#ipykernel_launcher for ~/Desktop/Untitled-1.ipynb in ~/Desktop with ports 9001, 9000, 9004, 9002, 9003
16:56:23.050 [debug] Conda file is conda
16:56:23.418 [debug] Got env vars from Python Ext in 718ms for /opt/miniconda3/envs/pytorch/bin/python, with env var count 50. 
    PATH value is /opt/miniconda3/envs/pytorch/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin and 
    Path value is undefined
16:56:23.418 [debug] Prepend PATH with python bin for /opt/miniconda3/envs/pytorch/bin/python
16:56:23.418 [debug] Activated Env Variables for /opt/miniconda3/envs/pytorch/bin/python, 
    PATH value is /opt/miniconda3/envs/pytorch/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin and 
    Path value is undefined
16:56:23.418 [debug] Getting activated env variables, Class name = Pp, completed in 718ms, has a truthy return value, Arg 1: undefined, Arg 2: "/opt/miniconda3/envs/pytorch/bin/python", Arg 3: undefined
16:56:23.418 [info] Process Execution: /opt/miniconda3/envs/pytorch/bin/python -m pip list
16:56:23.421 [debug] Got env vars from Python Ext in 718ms for /opt/miniconda3/envs/pytorch/bin/python, with env var count 50. 
    PATH value is /opt/miniconda3/envs/pytorch/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin and 
    Path value is undefined
16:56:23.421 [debug] Prepend PATH with python bin for /opt/miniconda3/envs/pytorch/bin/python
16:56:23.421 [debug] Activated Env Variables for /opt/miniconda3/envs/pytorch/bin/python, 
    PATH value is /opt/miniconda3/envs/pytorch/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin and 
    Path value is undefined
16:56:23.421 [debug] Getting activated env variables, Class name = Pp, completed in 718ms, has a truthy return value, Arg 1: "~/Desktop/Untitled-1.ipynb", Arg 2: "/opt/miniconda3/envs/pytorch/bin/python", Arg 3: undefined
16:56:23.422 [info] Process Execution: /opt/miniconda3/envs/pytorch/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
16:56:23.422 [debug] Kernel Env Variables for /Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.2024041101-darwin-arm64/temp/jupyter/kernels/python3818jvsc74a57bd087998d4b2a08f200e53bd85c2d7b01bf2b69127f748e5c1e9a18138bae014c82/kernel.json, PATH value is /opt/miniconda3/envs/pytorch/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
16:56:23.422 [info] Process Execution: /opt/miniconda3/envs/pytorch/bin/python -m ipykernel_launcher --f=/Users/~/Library/Jupyter/runtime/kernel-v2-11894yv4clsxwNDkU.json
    > cwd: ~/Desktop
16:56:23.422 [debug] Kernel process 11981.
16:56:23.427 [debug] Waiting for Raw Session to be ready in postStartRawSession
16:56:23.427 [debug] Waiting for Raw session to be ready, status: connected
16:56:23.427 [debug] Raw session connected
16:56:23.427 [debug] Waiting for Raw session to be ready
16:56:23.427 [debug] Waited for Raw session to be ready & got status: connected
16:56:23.427 [debug] Successfully waited for Raw Session to be ready in postStartRawSession
16:56:23.427 [debug] Kernel status is 'unknown' before requesting kernel info and after ready
16:56:23.427 [debug] Sending request for kernelInfo
16:56:23.504 [debug] Interpreter for Pylance for Notebook URI "~/Desktop/Untitled-1.ipynb" is /opt/miniconda3/envs/pytorch/bin/python
16:56:23.513 [debug] ipykernel version & path 6.29.4, /opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/ipykernel/__init__.py for /opt/miniconda3/envs/pytorch/bin/python
16:56:23.631 [debug] Kernel output 11981: To connect another client to this kernel, use:
--existing kernel-v2-11894yv4clsxwNDkU.json
16:56:23.930 [debug] Did not get a response for requestKernelInfo
16:56:23.930 [debug] Sending request for kernelInfo
16:56:23.932 [debug] Got response for requestKernelInfo
16:56:23.932 [debug] Successfully completed postStartRawSession after 2 attempt(s) in 505ms
16:56:23.933 [debug] Executing silently Code (idle) = import sys as _VSCODE_sys\nprint(_VSCODE_sys.executable); del _VSCODE_sys
16:56:23.937 [debug] Executing silently Code (completed) = import sys as _VSCODE_sys\nprint(_VSCODE_sys.executable); del _VSCODE_sys with 1 output(s)
16:56:23.937 [debug] Started running kernel initialization for ~/Desktop/Untitled-1.ipynb
16:56:23.937 [debug] Executing silently Code (idle) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy
16:56:23.940 [debug] Executing silently Code (completed) = try:\nimport ipywidgets as _VSCODE_ipywidgets\nprint("e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPy with 0 output(s)
16:56:23.940 [debug] Determined IPyWidgets Version as undefined
16:56:23.940 [debug] Executing silently Code (idle) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None):
16:56:23.947 [debug] Executing silently Code (completed) = def __VSCODE_inject_module():\ndef __VSCODE_call_function(function, callback, data=None): with 0 output(s)
16:56:23.947 [debug] Requesting Kernel info
16:56:23.947 [debug] Got Kernel info
16:56:23.947 [debug] End running kernel initialization, now waiting for idle
16:56:23.947 [debug] Waiting for idle on (kernel): 7af50a13-e25d-42eb-8374-14002c715610 -> idle
16:56:23.947 [debug] Finished waiting for idle on (kernel): 7af50a13-e25d-42eb-8374-14002c715610 -> idle
16:56:23.947 [debug] End running kernel initialization, session is idle
16:56:23.947 [debug] Registering Kernel Completion Provider from kernel pytorch (Python 3.8.18) for language python
16:56:23.947 [debug] IPyWidgetScriptSource.initialize
16:56:23.948 [debug] getDataDirsImpl, Class name = qr (started execution), Arg 1: "~/Desktop/Untitled-1.ipynb", Arg 2: "/opt/miniconda3/envs/pytorch/bin/python"
16:56:23.948 [debug] Get Custom Env Variables, Class name = qm, completed in 0ms, has a truthy return value, Arg 1: undefined, Arg 2: "RunPythonCode"
16:56:23.948 [debug] Jupyter Paths : 
16:56:23.949 [info] Process Execution: /opt/miniconda3/envs/pytorch/bin/python /Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.2024041101-darwin-arm64/pythonFiles/printJupyterDataDir.py
16:56:23.961 [warn] Got a non-existent Jupyter Data Dir file:https:///Users/~/.local/share/jupyter
16:56:23.961 [debug] getDataDirsImpl, Class name = qr, completed in 13ms, has a truthy return value, Arg 1: "~/Desktop/Untitled-1.ipynb", Arg 2: "/opt/miniconda3/envs/pytorch/bin/python", Return Value: <Uri:/Users/~/Library/Jupyter>, <Uri:/opt/miniconda3/envs/pytorch/share/jupyter>, <Uri:/usr/local/share/jupyter>, <Uri:/usr/share/jupyter>
16:56:26.633 [info] Handle Execution of Cells 0 for ~/Desktop/Untitled-1.ipynb
16:56:26.633 [debug] Cell Index:0 sent to kernel
16:56:26.638 [debug] Start cell 0 execution @ 1713398186638 (clear output)
16:56:26.638 [debug] Kernel acknowledged execution of cell 0 @ 1713398186638
16:56:26.796 [info] Cell 0 completed in 0.158s (start: 1713398186638, end: 1713398186796)
16:56:26.796 [debug] Cell 0 executed successfully
16:56:43.944 [info] Starting debugging with mode 1
16:56:43.945 [debug] Executing silently Code (idle) = import builtins\nimport ipykernel\nbuiltins.print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d" + ipykernel._
16:56:43.949 [debug] Executing silently Code (completed) = import builtins\nimport ipykernel\nbuiltins.print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d" + ipykernel._ with 1 output(s)
16:56:43.988 [debug] [Debug] to kernel: {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","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}
16:56:43.988 [debug] [Debug] to kernel, mapped: {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","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}
16:56:44.013 [debug] KernelProcess error 11981: Traceback (most recent call last):
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/debugpy/adapter/__main__.py", line 215, in <module>
    __import__("debugpy")
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 35, in <module>
    from debugpy.public_api import *  # noqa
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 8, in <module>
    import typing
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/debugpy/adapter/../../typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/opt/miniconda3/envs/pytorch/lib/python3.8/site-packages/debugpy/adapter/../../typing.py", line 1007, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

16:56:54.185 [debug] [Debug] response: {"command":"initialize","request_seq":1,"seq":3,"success":false,"type":"response"}
16:56:54.186 [debug] [Debug] to kernel: {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":2}
16:56:54.186 [debug] [Debug] to kernel, mapped: {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":2}
16:56:54.187 [debug] [Debug] response: {}`

@flyforwardFast
Copy link
Author

Hi Don, after look into the log, i found this is a known issue about the Typing package (Vscode debugger does not run for all available kernels). The issue has been resolved by uninstall typing package.
The question remains the same why Jupyter is bothered by typing?

@VSCodeTriageBot
Copy link
Collaborator

Hey @DonJayamanne, this issue might need further attention.

@flyforwardFast, you can help us out by closing this issue if the problem no longer exists, or adding more information.

@VSCodeTriageBot
Copy link
Collaborator

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@VSCodeTriageBot VSCodeTriageBot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants