librosa: installs properly only with clone git AND cannot use any functions though it imports

回眸只為那壹抹淺笑 提交于 2020-01-24 22:45:13

问题


I'm quite a newbie with python, and programming in general, and I am currently struggling with installing and using the library librosa. I thought I succeeded installing it with:

git clone https://github.com/librosa/librosa.git librosa

and also with installing numpy and scipy seperately, again with:

git clone https://github.com/numpy/numpy.git numpy
git clone https://github.com/scipy/scipy.git scipy

and it seemed to finally work. I could also:

import librosa

without any problems, but as I tried to use:

librosa.load(pathfile, y, sr) 

or also:

filename = librosa.util.example_audio_file()

I get the error message:

Traceback (most recently call last):
File "home/pi/new version.py", line 17, in <module> 
slowbeat_lib = librosa.load('home/pi/gpio-music-box/samples/slowbeat.ogg', y, sr=None)
Attribute Error: module 'librosa'has no attribute 'load'

The same with:

librosa.util

So, I was thinking that I probably didn't install it completely, or in the right directory, because it is not in the usr/lib, but in home/pi/...

I tried to change that, but failed. Also installing it with:

pip install

sudo pip install

never worked out, because it always failed to build wheels for several side packages such as numpy, scipy, llvmlite,... --> That's also quite weird, right?

Or could the problem be something totally different?

So actually I am quite helpless, and thankful for any hint or advice! :)


回答1:


It makes that sense that when you install librosa it would fail on scipy/numpy/llvmlite. pip will automatically try to install the dependencies for librosa.

You definitely want to install using pip. The github repo of librosa is not packaged the same, and it's meant for people working on librosa code, rather than using it as a library.

On a raspberry-pi system, pip install --user librosa is what you want.

Keep in mind that some of the python packages are just wrappers around C code. When you pip install llvmlite you're just installing the wrapper.

I'd look at this answer on a similar question here: https://stackoverflow.com/a/46840976/564872

specifically the line: sudo apt install libblas-dev llvm python3-pip python3-scipy (assuming that you're using python3)



来源:https://stackoverflow.com/questions/52792710/librosa-installs-properly-only-with-clone-git-and-cannot-use-any-functions-thou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!