SynthstromAudible / dbt-toolchain

Toolchain for Deluge Build Tool (DBT)
GNU General Public License v3.0
2 stars 3 forks source link

Windows - DBT fails to load rtmidi - ImportError: DLL load failed while importing _rtmidi #9

Closed KyleKirkpatrick closed 4 months ago

KyleKirkpatrick commented 5 months ago

When attempting to run a command like ./dbt loadfw on an x64 Windows system, an error related to rtmidi is thrown.

PS C:\00_mycroft\project\development\deluge\DelugeFirmware> ./dbt loadfw -h
C:\00_mycroft\project\development\deluge\DelugeFirmware
Traceback (most recent call last):
  File "C:\00_mycroft\project\development\deluge\DelugeFirmware\dbt.py", line 137, in <module>
    retcode = main()
              ^^^^^^
  File "C:\00_mycroft\project\development\deluge\DelugeFirmware\dbt.py", line 118, in main
    retcode = importlib.import_module(tasks[task_name]).main()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\00_mycroft\project\development\deluge\DelugeFirmware\toolchain\v15\win32-x86_64\python\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\00_mycroft\project\development\deluge\DelugeFirmware\scripts\tasks\task-loadfw.py", line 6, 
in <module>
    import rtmidi
  File "C:\00_mycroft\project\development\deluge\DelugeFirmware\toolchain\v15\win32-x86_64\python\Lib\site-packages\rtmidi\__init__.py", line 4, in <module>
    from ._rtmidi import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing _rtmidi: The specified module could not be found.

Discord user nobodybelievesyou has reported this error occurring on several Windows machines with a freshly-installed development environment.

A similar issue was reported here: https://github.com/SpotlightKid/python-rtmidi/issues/91 Which suggested that installing vc_redist.x86.exe was required, however this has not remediated the issue with DBT. The linked python-rtmidi issue 91 also pertains to an ARM system, whereas this error is occuring on x64 Windows systems.

nikodemus commented 4 months ago

I believe this is because the installed python version is statically linked, and does not include python312.dll, which the rtmidi library appears to link to.