1

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! :)

drwbns
  • 89
  • 10
  • When you clone a source code repository, it doesn't always mean that it suffice for the library to count as installed - there may be files that should be compiled to binaries first, or placed to correct directory. I'd suggest you rather solve the installation issue first - what is the error message you get when running `pip install librosa --user -vvv`? Best is to copy the complete command output text from terminal and add it to your question. – hoefling Oct 13 '18 at 21:58

1 Answers1

0

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)

Civilian
  • 614
  • 2
  • 9
  • 29
  • I tried your suggestion and I looked at the other question and tried it out,but it's unfortunately not working for me - still thank you for trying to help though – Lola Pfeifer Nov 05 '18 at 17:57