librosa: librosa 0.6.1 install fails during set-up of llvmlite 0.24.0
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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 26 (9 by maintainers)
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
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_dirUse the following command from inside the build directory to configure the llvm build (I am not sure the
sudois 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 . -- -j4This 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/ldAfter build completes, install with
sudo cmake --build . --target installNow llvmlite 0.24.0 will install without error:
pip3 install llvmliteNow librosa 0.61 will install without error:
pip3 install librosaHowever, this is still not quite enough: when trying to import librosa, it still throws an error, namely
The error is fixed with:
sudo apt-get install libatlas-base-devIt 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.
You can close it,
even though I don’t think there is a satisfactory solution - it is still necessary to go through the pain of build llvm to get llvmlite - but that’s not a librosa issue.
Michael
On Jul 5, 2019, at 16:01, Brian McFee <notifications@github.commailto:notifications@github.com> wrote:
Any objection to closing this out?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/librosa/librosa/issues/757?email_source=notifications&email_token=ACAKGIO3SHQ4YSFSF4ABUWDP55H23A5CNFSM4FOJJVAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJTB5I#issuecomment-508768501, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACAKGIKVZ6O73YSHBA4Z3CDP55H23ANCNFSM4FOJJVAA.
@kim-sunghoon , everything seems to install properly yet you get this error. I cannot reproduce it since I am on a Raspberry and everything works, as described. The only idea I have is that something went wrong in the llvm build: sudo cmake llvm-7.0.1.src -DLLVM_TARGETS_TO_BUILD=“ARM” -DCMAKE_BUILD_TYPE=“Release" Double-check you have the right target specified. I don’t think this is a librosa issue. You might want to post your question on a llvm-related forum.
If you use berryconda you can simply:
and it will just work. The LLVM 7 build needed for llvmlite and Numba to work correctly also requires source level patching as described here https://llvmlite.readthedocs.io/en/latest/admin-guide/install.html#compiling-llvm.
CC: @seibert @sklam
Numba 0.42 is now supported on RPi with berryconda.