question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

librosa 0.6.1 install fails during set-up of llvmlite 0.24.0

See original GitHub issue

Description

sudo pip install librosa fails while setting up llvmlite.

I realize this is not a librosa issue per se, but the librosa install REQUIRES llvmlite > 0.24.0, and there apparently is no easy way to install that version of llvmlite except for first building llvm from source which is difficult and I have not been successful yet.

Does librosa really require llvmlite 0.24.0 or would 0.15.0 work which installs without problems?

Steps/Code to Reproduce

It should be possible to reproduce this on any system that doesn’t yet have llvmlite installed. The error is the same as when installing llvmlite stand-alone: sudo pip install llvmlite

Expected Results

Actual Results

Versions

Raspberry Pi Newest version of Stretch Python 3.5.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
mikechen66commented, May 2, 2020

Solution to librosa installation:

You can install LLVM 7 from the Ubuntu apt repo, i.e., you do need to build it from source. That is quite complex. The simple method is listed as follows.

$ sudo apt-get install llvm-7 llvm-7-dev $ export LLVM_CONFIG=/usr/bin/llvm-config-7 $ pip install librosa

It is much more elegant and straightforward.

Cheers,

Mike

3reactions
mweber-ovtcommented, Aug 10, 2018

I was able to install librosa on my Raspberry Pi 3B+ only after building llvm from source. With llvm 6.0.1 present, llvmlite 0.24.0 will install, and the librosa install will be successful. It was quite an ordeal to get llvm build. The instructions here are helpful but require some tweaking: https://releases.llvm.org/6.0.1/docs/CMake.html#frequently-used-cmake-variables

Building llvm for a Raspberry Pi 3 required a few modifications to the base system: 1.) 64GB SD card - else the build runs out of disk space (see note further down) 2.) 2GB swap file - else the linker runs out of memory

Assuming the llvm sources have been downloaded and extracted into this directory: ~/Downloads/llvm-6.0.1.src

Create a build directory, e.g. $ mkdir llvm_build_dir $ cd llvm_build_dir

Use the following command from inside the build directory to configure the llvm build (I am not sure the sudo is necessary but didn’t have the patience to try without):

sudo cmake ~/Downloads/llvm-6.0.1.src -DLLVM_TARGETS_TO_BUILD="ARM" -DCMAKE_BUILD_TYPE="Release"

Use the following build command to build and link using all four CPUs: $ sudo cmake --build . -- -j4 This will take several hours. In hindsight, building with the “Release” option results in much smaller llvm file size and may not require the 64GB SD card, but I didn’t confirm that.

The build should go through but if the linker runs out of memory, refer to this website: https://stackoverflow.com/questions/25197570/llvm-clang-compile-error-with-memory-exhausted The following worked for me: sudo ln -s 'which gold' /usr/local/bin/ld

After build completes, install with sudo cmake --build . --target install

Now llvmlite 0.24.0 will install without error: pip3 install llvmlite

Now librosa 0.61 will install without error: pip3 install librosa

However, this is still not quite enough: when trying to import librosa, it still throws an error, namely

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

The error is fixed with: sudo apt-get install libatlas-base-dev

It should be possible at this stage to remove the llvm source and build directory to free up many GB on the SD card, but I haven’t tested that yet.

Hopefully sharing this will be useful for other people. Maybe in the future somebody comes up with an easier way to install llvmlite that doesn’t require building llvm first, but for the time being this works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to install librosa - Stack Overflow
First, update setuptools and wheel python3 -m pip install ... Try to install the previous version of librosa pip install librosa==0.7.2.
Read more >
Package List — Spack 0.20.0.dev0 documentation
This is a list of things you can install using Spack. It is automatically generated based on the packages in this Spack version....
Read more >
pip install fails on NVIDIA Jetson TX2 - Google Groups
cd librosa-0.6.0.zip sudo pip install -e . running install running build got version from file /tmp/pip-install-ZUciLA/llvmlite/llvmlite/_version.py ...
Read more >
Installation - Numba
Installing Numba from source is fairly straightforward (similar to other Python packages), but installing llvmlite can be quite challenging due to the need ......
Read more >
ForwardTacotron TTS - Kaggle
The following additional packages will be installed: espeak-data ... built librosa pyworld Installing collected packages: llvmlite, numba, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found