I tried to debug a notebook in VS Code but I can't. When I set a breakpoint and run debug cell or press F5, I am getting this error
/usr/bin/env /home/user/anaconda3/envs/myenv/bin/python /home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 53439 -- /home/user/Desktop/bank/pipeline_for_labling/labeling.ipynb
^[[15~Traceback (most recent call last):
File "/home/user/anaconda3/envs/myenv/lib/python3.11/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/anaconda3/envs/myenv/lib/python3.11/runpy.py", line 88, in _run_code
exec(code, run_globals)
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
cli.main()
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 508, in main
run()
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 358, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
_run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
File "/home/user/.vscode/extensions/ms-python.debugpy-2025.18.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
exec(code, run_globals)
File "/home/user/Desktop/bank/pipeline_for_labling/labeling.ipynb", line 577, in <module>
"execution_count": null,
^^^^
NameError: name 'null' is not defined
Previously I used Python files to debug, but now, I am using heavy libraries like torch, so in the py file each when I pause debugging to change the code and debug again, I waited too much for libraries to be loaded.
I don't know which debugger I should choose and maybe configure the launch.json file in .vscode directory. Has anyone had a similar problem? How should I fix this?
This is the launch.json file, should I set name to jupyter for example?
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
You get that error because you trying to debug .ipynb file (the file type which works in Jupyter) like a .py (the file type which works in VS Code). So you probably dont have Jupyter extension in VS Code. Download it, then do not press F5 to debug; press the button 'Debug Cell' to debug it