microsoft/debugpy

_pydevd_sys_monitoring_cython._get_func_code_info KeyError

ixzhao opened this issue · 1 comments

Python: 3.12.7
vs code: 1.95.3 (user setup)
OS: Windows_NT x64 10.0.19045
Python Debugger: v2024.12.0

If I execute "start debugging", error occurs. If I choose to "run without debugging", nothing happens.
Upgrade python debugger extension to prerelease v2024.13.2024112901 didn't help. Downgrade to v2024.10.0 helps.

Traceback

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: (629, 'd:\\PythonEnv\\whisper\\Lib\\site-packages\\librosa\\core\\spectrum.py', <code object __overlap_add at 0x00000213EB954F60, file "d:\PythonEnv\whisper\Lib\site-packages\librosa\core\spectrum.py", line 629>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\PythonEnv\Python312\Lib\runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\PythonEnv\Python312\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 71, in <module>
    cli.main()
  File "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 501, in main
    run()
  File "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-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 "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-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 "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-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 "c:\Users\zhao\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "D:\Download\test.py", line 9, in <module>
    output_files = separator.separate(audio_file)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\audio_separator\separator\separator.py", line 774, in separate
    output_files = self.model_instance.separate(audio_file_path, primary_output_name, secondary_output_name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\audio_separator\separator\architectures\vr_separator.py", line 194, in separate
    self.primary_source = self.spec_to_wav(y_spec).T
                          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\audio_separator\separator\architectures\vr_separator.py", line 354, in spec_to_wav
    wav = spec_utils.cmb_spectrogram_to_wave(spec, self.model_params, is_v51_model=self.is_vr_51_model)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\audio_separator\separator\uvr_lib_v5\spec_utils.py", line 362, in cmb_spectrogram_to_wave
    wave = spectrogram_to_wave(spec_s, bp["hl"], mp, d, is_v51_model)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\audio_separator\separator\uvr_lib_v5\spec_utils.py", line 319, in spectrogram_to_wave
    wave_left = librosa.istft(spec_left, hop_length=hop_length)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\PythonEnv\whisper\Lib\site-packages\librosa\core\spectrum.py", line 571, in istft
    __overlap_add(head_buffer, ytmp, hop_length)
  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 istft at 0x00000213EA22FC60, file "d:\PythonEnv\whisper\Lib\site-packages\librosa\core\spectrum.py", line 393> != <code object __overlap_add at 0x00000213EB954F60, file "d:\PythonEnv\whisper\Lib\site-packages\librosa\core\spectrum.py", line 629>

reproduce from scratch

create a virtual python environment using venv, and pip install "audio-separator[gpu]".

test.py

from audio_separator.separator import Separator

audio_file = "audio_cut.mp3"

separator = Separator(model_file_dir=r"C:\Users\zhao\.audio-separator-models")
separator.load_model(model_filename="UVR-DeNoise-Lite.pth")

output_files = separator.separate(audio_file)
print(f"Separation complete! Output file(s): {' '.join(output_files)}")

breakpoint set to the last line.

Thanks for the issue. I would hazard a guess that something in the audio_separator library is using sys.monitoring or doing its own bytecode creation and it doesn't work with how debugpy debugs 3.12 and above. That error you're showing happens when sys.monitoring gets confused. (v 2024.10.0 of the debugger extension uses the older debugpy before we switched to sys.monitoring).

You can try the same thing with 3.11 or ask audio_separator if they're generating their own byte code.

See this similar issue:
#1719