jaakkopasanen / AutoEq

Automatic headphone equalization from frequency responses
MIT License
13.22k stars 2.47k forks source link

Upgrade soundfile to 0.11.0 to fix issue finding libsndfile.dylib #560

Closed douglascamata closed 1 year ago

douglascamata commented 1 year ago

Lately the soundfile package hasn't been able to import the proper libsndfile.dylib in a M1 Macbook, even after installing it with brew install libsndfile:

❯ venv/bin/python -m autoeq --help
Traceback (most recent call last):
  File "/private/tmp/test/venv/lib/python3.10/site-packages/soundfile.py", line 142, in <module>
    raise OSError('sndfile library not found')
OSError: sndfile library not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/doolivei/.asdf/installs/python/3.10.7/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/doolivei/.asdf/installs/python/3.10.7/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/private/tmp/test/venv/lib/python3.10/site-packages/autoeq/__main__.py", line 9, in <module>
    from autoeq.batch_processing import batch_processing
  File "/private/tmp/test/venv/lib/python3.10/site-packages/autoeq/batch_processing.py", line 6, in <module>
    import soundfile as sf
  File "/private/tmp/test/venv/lib/python3.10/site-packages/soundfile.py", line 162, in <module>
    _snd = _ffi.dlopen(_os.path.join(
OSError: cannot load library '/private/tmp/test/venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib': dlopen(/private/tmp/test/venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib, 0x0002): tried: '/private/tmp/test/venv/lib/python3.10/site-packages/_soundfile_data/libsndfile.dylib' (no such file)

I found that the creator of Python's soundfile did a new release just recently to fix it: https://github.com/bastibe/python-soundfile/issues/325. In this release, the correct libsndfile.dylib file is bundled together with the Python package.

This pull request upgrades the soundfile package dependency to the new 0.11.0 release.

I have tested this locally and it solves the problem.

jaakkopasanen commented 1 year ago

Forgot about this PR but ended up implementing the change myself. Thanks anyways!