running librosa & numba on raspberry pi 3

前端 未结 5 1651
离开以前
离开以前 2020-12-19 16:28

I am trying to run librosa on my raspberry pi 3. After hours of searching through the internet I was finally able to install it but it still throws an error when I try to i

相关标签:
5条回答
  • 2020-12-19 16:46

    sudo pip install librosa==0.4.2 worked for me. There was warning yet works fine on Raspberry pi3 (OS:raspbian-jessie)

    0 讨论(0)
  • 2020-12-19 16:50

    As of writing, the latest Raspbian release has llvm-3.8, so per this github comment you need to install llvmlite v0.15.0 with numba v0.30.1. If you're on a different llvm then you will need to explore what versions of llvmlite and numba to use with that version of llvm. Here are the commands that got me set up to get a successful import librosa:

    sudo apt install libblas-dev llvm python3-pip python3-scipy
    virtualenv --system-site-packages -p python3 env
    source env/bin/activate
    pip install llvmlite==0.15.0
    pip install numba==0.30.1
    pip install librosa
    

    Note I'm using virtualenv and dragging in scipy and numpy from the system packages, otherwise it's hard to get the fortran & c dependencies right plus those take ages to compile on a RPi. If you want to install system-wide then drop the 2nd and 3rd line and put sudo in front of the pip commands. I've also frozen my requirements in this requirements.txt file so if you download that then you can run a single command pip install -r requirements.txt

    0 讨论(0)
  • 2020-12-19 16:56

    Thanks @MatthewBerryman, you got me over the hump! On the newest Raspian release (stretch) I was successful with the following after several hours of frustration of trying to get librosa installed on Raspian jessie (which my RPi3 came with). Having said this, the following procedure may also work with jessie.

    First, update your system's package list and upgrade all your installed packages to their latest versions with the command:

    sudo apt-get update
    sudo apt-get dist-upgrade
    

    Install Python science stack:

    sudo pip3 install numpy --upgrade 
    sudo apt-get install python3-pandas
    

    (Also seems to install matplotlib, scipy)

    sudo apt-get install python3-sklearn
    

    Then, install the low-level virtual machine, LLVM (per @MatthewBerryman, I used llvm 3.8 and llvmlite 0.15.0, and not the newest combination where I couldn't find the packages.) After installing llvm-3.8, a symbolic link needs to be defined before installing llvmlite.

    sudo apt-get install llvm-3.8
    sudo ln -s /usr/bin/llvm-config-3.8 /usr/bin/llvm-config
    sudo pip3 install llvmlite==0.15.0
    sudo pip3 install numba==0.32.0
    

    Numba is 0.32.0 because if it's the newest (0.36), it will not import because of an llvm mismatch, and if it's a lower version, the librosa install will upgrade it to the newest version.

    Finally, install librosa:

    sudo pip3 install librosa
    

    However, when trying to import librosa, it still throws and error, namely

    ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory
    

    Googling this error indicated this would fix it:

    sudo apt-get install libatlas-base-dev
    

    And it did; however, I have no idea why.

    To summarize, this procedure installs librosa, and there is no error when trying this:

    ...$ python3
    Python 3.5.3 (default, Jan 19 2017, 14:11:04)
    ...
    >>>import librosa
    >>>
    
    0 讨论(0)
  • 2020-12-19 17:01

    https://raspberrypi.stackexchange.com/questions/111697/unable-to-pip-install-librosa-in-raspberry-pi-3-model-b-raspbian-stretch

    Anyone can refer this link , I got a successful install in RPi 3 B+ with Raspbian Buster OS

    0 讨论(0)
  • 2020-12-19 17:05

    If you have previously installed packages, either reboot with a fresh copy of OS or create a virtual environment, as suggested by others. Creating virtual env did not work at the first try for me, you might want to reboot to a fresh copy.

    Then install virtualenv and create a new virtualenv.

    Activate the virtualenv using python3.

    sudo apt-get install llvm
    

    You should get llvm 7.0.x

    Then install a compatible llvmlite - this works for 7.0. Get the path by typing which llvm-config In my case it was /usr/bin/llvm-config

    LLVM_CONFIG=/usr/bin/llvm-config pip3 install llvmlite==0.32
    

    install dependencies

    pip3 install numpy==1.16.1 numba==0.49
    
    pip3 install librosa
    

    If you get an error after trying to import librosa due to numpy, update dependencies

    sudo apt-get install libatlas-base-dev
    

    Credits to this tutorial

    0 讨论(0)
提交回复
热议问题