-
Notifications
You must be signed in to change notification settings - Fork 112
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
Can't open FLAC file with read on macOS (get unimplemented format error) #237
Comments
How did you install soundfile? My first guess would be that you did not install the wheel version (which comes with a full-featured libsndfile), but used some other installation method instead that does not come with its own libsndfile, thus using your system's libsndfile, which is lacking FLAC support. |
I am getting the same error. I did a conda install librosa, which took care of libsndfile dependencies |
I'm working in a conda environment with:
|
The problem in your case is probably that you're using |
That was a problem, but I uninstalled pysoundfile, and now installed soundfile (v0.10.3). |
You'll have to check which version of libsndfile is actually used by soundfile. It might still be using the one from conda, which would explain why the newer version of soundfile (which comes with a fully-configured libsndfile) didn't fix the problem. Since you seem to be on macOS, you can also try installing libsndfile through homebrew. If I remember correctly, homebrew has options for enabling FLAC support. If all else fails, you can use |
@MR-T77 You can try this to find out which libsndfile is used on your system: import soundfile as sf
print(sf._libname) |
Thanks for your help @bastibe and @mgeier. Unfortunately, I'm a little bit lost on what to do next... |
This tells you from which file on your system the The path you are getting points somewhere inside your Anaconda folder. It's not the one distributed with the There seem to be FLAC problems with the macOS version of the Anaconda package, see conda-forge/libsndfile-feedstock#2 and librosa/librosa#847 (comment). There doesn't seem to be a resolution. You should try to uninstall |
I just stumbled across this very issue, but the source of the conflicting Unfortunately,
After uninstalling
Unfortunately, tools like ffmpeg, sox, etc I use routinely, so removing the homebrew bundled dependency for it is rather problematic. Would there be a workaround to specify which |
You could probably LD_PRELOAD it. (I think that works on macOS, right?) |
AFAIK LD_PRELOAD does not work on macOS/OSX, but I'm operating out of my depth here. After re-installing libsndfile via homebrew: For the record, this is the location of my
Looking through the documentation for
|
The First, it tries to find the library with The problem here is that the first attempt does not fail ... As a work-around, you can monkey-patch the def dummy_find_library(name):
return None
import ctypes.util
ctypes.util.find_library = dummy_find_library
import soundfile as sf
... |
Another idea: Why not just overwrite I assume this is a symbolic link provided by You could just copy the |
After I posted my reply, I noticed that too! I don't have enough experience doing this sort of thing to make a recommendation on how it should be done so I leave that to the judgment of more experienced folks. I am curious though if it would be worthwhile to try loading the hard-coded path first and then fall back on
I think this is what I'll end up doing for the time being. I must admit I am curious why their version of libsndfile does not support flac files, but that's not a topic for this issue tracker. Thanks for your input @mgeier ! |
If there would be consideration for implementing the change where first soundfile attempts to read the hard-coded paths before falling back on |
I don't think there is a "right" or "wrong" order in which to look for the library, each one has their advantages and disadvantages. The original idea was to give users a simple way to override the pre-packaged library with their own. As usual in Linux (and this works in macOS as well), they could put their version of the library into That's exactly what happened in your case, @j9ac9k. If someone puts a library into Now if we reverse the order of library loading, this wouldn't be possible anymore, people would not (easily) be able to provide their own library version. This might actually be an advantage for some users, but I think in general it's not. If we disable the current customization opportunity, I think we should introduce a new one, do you have an idea for that? I wanted to mention a related discussion in spatialaudio/python-sounddevice#130, but then I saw that you have also commented there! UPDATE: another related issue: #222. |
I'm getting this issue on ubuntu as well. |
I didn't come up w/ a good fix; in my case I just uninstalled the libsndfile that was packaged via homebrew. I do periodically think about this issue; I suspect an environment variable may be the way to go here; I'm not sure how difficult that would be to implement though. |
This would be relatively easy to implement. Pull requests would certainly be welcome! |
I'm getting the same issue on ubuntu 20: 04 When I uninstall libsndfile, it uninstalled librosa as well and when I install just soundfile and libsndfile. any ideas why this is so? |
Find a work around with the issue hope it might help out, but what I did was I uninstall librosa and it uninstalled all it dependent packages and I install soundfile and loaded the .flac file and it works. I uninstall just that package soundfile._libname default to "libsnfile.so.1", which works alongside librosa. Hoping to get a far more better and accurate solution in the future. |
Hallefrickenluja! @vegasc you rescued me from 5 hours of package hell. conda remove --force libndfile worked for me! |
Hi!
I got an issue when trying to open a FLAC file using the following simple code:
That results in the following traceback:
The available formats don't show FLAC:
but the subformats with format flac does:
Also FLAC is in the supported formats in both soundfile.py and sndfile.h
Also, FLAC files can be played in macOS.
Does anyone know how to resolve that issue?
Thanks in advance
The text was updated successfully, but these errors were encountered: