Problem with dylib import on macos

Answered

Hello,

I've been struggling for a while with `torchaudio` failing to import `sox` and `ffmpeg` dylibs when running my script in PyCharm.

The issue is described here and there.

To summarize, after installing `torchaudio` with `uv` in my environment, when running the simple script `import torchaudio; torchaudio.list_audio_backends()`
- from terminal, everything works fine, `torchaudio` finds the `ffmpeg` and `sox` dylibs (installed with `homebrew`) which are located in a directory included in the `DYLD_LIBRARY_PATH` environment variables,
- from PyCharm Run or Debug buttons: `torchaudio` can not find the `ffmpeg` and `sox`, even if I set the `DYLD_LIBRARY_PATH` environment variable in my script before importing `torchaudio`.

Two things that make the issue difficult to understand for me:
- I did not have that issue on my previous computer (macOS 14 whereas my new computer runs macOS 15, otherwise the enrvionment is pretty similar)
- The issue is specific to `uv`, installing environment with `venv` and `pip` manually solves the problem.

I am a bit stuck here and debugging has become quite complicated.   

Do you have any hint that may help me solve my issue?

Thank you all 🙏

0
2 comments

Please create a new bug report on YouTrack and provide the specific example project so we can try to replicate it from our side.

0

I found a solution to my problem.

From what I understood, this was a problem of LC_RPATH. The problem disappeared when I deleted and re-installed my Python interpreters.

I am not sure what happened, my guess is that my libraries paths were not setup correctly when I originally installed my Python interpreters, which resulting in missing LC_RPATH.

Since I re-installed the Python interpreters (in my case with uv) with a clean and fully functional environment, everything works fine.

0

Please sign in to leave a comment.