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

debugpy >=1.8.6 errors out when used with numba #1719

Closed
hoxbro opened this issue Nov 3, 2024 · 3 comments
Closed

debugpy >=1.8.6 errors out when used with numba #1719

hoxbro opened this issue Nov 3, 2024 · 3 comments
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@hoxbro
Copy link

hoxbro commented Nov 3, 2024

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.6-1.8.9
  • OS and version: Linux and Python 3.12
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Debugpy errors out when used with Numba

Expected behavior

The code runs as it did with debugpy 1.8.5

Steps to reproduce:

Run the following code in with a breakpoint

import numba as nb


@nb.njit
def nb_sum(arr):
    xs = 0
    for x in arr:
        xs += x
    return xs


res = nb_sum([1, 2])
print("Set breakpoint here")

Image

Traceback (most recent call last):
  File "_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx", line 555, in _pydevd_sys_monitoring_cython._get_func_code_info
KeyError: (3, '/home/shh/projects/holoviz/repos/holoviews/example3.py', <code object nb_sum at 0x7a127fc59110, file "/home/shh/projects/holoviz/repos/holoviews/example3.py", line 3>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.12/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shh/miniconda3/envs/holoviz/lib/python3.12/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/home/shh/.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
    cli.main()
  File "/home/shh/.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
    run()
  File "/home/shh/.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/shh/.vscode/extensions/ms-python.debugpy-2024.12.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/shh/.vscode/extensions/ms-python.debugpy-2024.12.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/shh/.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "/home/shh/projects/holoviz/repos/holoviews/example3.py", line 10, in <module>
    res = nb_sum([1,2])
          ^^^^^^^^^^^^^
  File "<stringsource>", line 69, in cfunc.to_py.__Pyx_CFunc_893235__29_pydevd_sys_monitoring_cython_object__lParen__etc_to_py_4code_18instruction_offset.wrap
  File "_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx", line 1662, in _pydevd_sys_monitoring_cython._start_method_event
  File "_pydevd_sys_monitoring\\_pydevd_sys_monitoring_cython.pyx", line 562, in _pydevd_sys_monitoring_cython._get_func_code_info
AssertionError: <code object <module> at 0x7a127fc8d230, file "/home/shh/projects/holoviz/repos/holoviews/example3.py", line 1> != <code object nb_sum at 0x7a127fc59110, file "/home/shh/projects/holoviz/repos/holoviews/example3.py", line 3>
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Nov 3, 2024
@hoxbro
Copy link
Author

hoxbro commented Nov 22, 2024

It still seems to error out on 1.8.9

@rchiodo
Copy link
Contributor

rchiodo commented Nov 28, 2024

I would hazard a guess that numba's jitting is interfering with sys.monitoring. See this issue in numba:
numba/numba#9760

And this issue which looks to be the same as yours:
numba/numba#9753

@rchiodo rchiodo closed this as completed Nov 28, 2024
@LancelotGitech
Copy link

Current workaround is to downgrade either numba to 0.59.1 or python debugger to v2024.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

4 participants