Skip to content
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

Cannot load when importing librosas #1117

Closed
linwanting opened this issue May 13, 2020 · 7 comments
Closed

Cannot load when importing librosas #1117

linwanting opened this issue May 13, 2020 · 7 comments
Labels
Upstream/dependency bug Another package is causing us trouble!

Comments

@linwanting
Copy link

Cannot load when importing librosa, conda local installation, version 0.7.2, the error code is as follows

import librosa
Traceback (most recent call last):

File "G:\Anaconda\lib\site-packages\soundfile-0.10.3.post1-py3.7.egg\soundfile.py", line 142, in
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 "", line 1, in
import librosa

File "G:\Anaconda\lib\site-packages\librosa-0.7.2-py3.7.egg\librosa_init_.py", line 12, in
from . import core

File "G:\Anaconda\lib\site-packages\librosa-0.7.2-py3.7.egg\librosa\core_init_.py", line 126, in
from .audio import * # pylint: disable=wildcard-import

File "G:\Anaconda\lib\site-packages\librosa-0.7.2-py3.7.egg\librosa\core\audio.py", line 10, in
import soundfile as sf

File "G:\Anaconda\lib\site-packages\soundfile-0.10.3.post1-py3.7.egg\soundfile.py", line 163, in
_path, '_soundfile_data', _libname))

OSError: cannot load library 'G:\Anaconda\lib\site-packages\soundfile-0.10.3.post1-py3.7.egg_soundfile_data\libsndfile64bit.dll': error 0x7e

@bmcfee bmcfee added the Upstream/dependency bug Another package is causing us trouble! label May 14, 2020
@bmcfee
Copy link
Member

bmcfee commented May 14, 2020

This problem is coming from libsndfile, a dependency of soundfile, not librosa.

Did you install librosa (and its dependencies) from conda-forge or pip? I recommend conda-forge if you're already in a conda environment, as that should settle the binary dependency issues. You should probably uninstall soundfile first before proceding though.

@bmcfee
Copy link
Member

bmcfee commented May 29, 2020

Closing this out, as this is an upstream issue and we can't do anything about it in librosa.

@bmcfee bmcfee closed this as completed May 29, 2020
@trenton3983
Copy link

You should probably uninstall soundfile first before proceding though.

This was an ineffective resolution.

  • For those using an Anaconda distribution, SoundFile is not available for a conda install.
  • In my case I had already done pip uninstall SoundFile, which then lead to an import error that the package couldn't be found
  • Then I did pip install SoundFile, which installed a newer version and resolved the error.
  • The solution seems to be pip install SoundFile --upgrade
  • This worked on Windows 10 with Anaconda, and python 3.8.11

@bmcfee
Copy link
Member

bmcfee commented Aug 29, 2021

For those using an Anaconda distribution, SoundFile is not available for a conda install.

I did explicitly say conda-forge, not conda. It is definitely available on conda-forge.

@trenton3983
Copy link

trenton3983 commented Aug 29, 2021

In my case, librosa was installed from the conda-forge channel.

conda-forge is just a channel of conda. SoundFile does not show up. However pysoundfile does. Are they the same?

conda-forge / packages / pysoundfile 0.10.3.post1

conda install -c conda-forge pysoundfile

This does not seem to work as a substitute for SoundFile.

@bmcfee
Copy link
Member

bmcfee commented Aug 29, 2021

Yes, they are the same. The package naming here is unfortunate, but out of our control.

@trenton3983
Copy link

trenton3983 commented Aug 29, 2021

Now I see, as you stated, it's the order of operation.

  1. pip uninstall SoundFile
  2. conda install -c conda-forge librosa
    • This will then properly install and use pysoundfile as a dependency

However, those finding this issue will likely have already installed librosa without removing SoundFile.

As I have just experienced, uninstalling librosa can lead to other issues because of file dependency removal with conda (even when using --force.

If librosa is installed already, then just update SoundFile: pip install SoundFile --upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Upstream/dependency bug Another package is causing us trouble!
Development

No branches or pull requests

3 participants