How to install the Librosa library in Jetson Nano or aarch64 module

If you are working in Nvidia Jetson nano to build your deep learning TTS projects or any projects that are required Librosa library, You should have faced the issue while pip installing the librosa in Jetson nano or aarch AMD64 architecture devices.

Even, I have faced the same issue and here are the steps that I followed to successfully installed in Nvidia Jetson nano device or any aarch AMD64 architecture.

Issue: When you install librosa, you should have received the error that is not able to find the llvm library. If so, just follow the below steps.

/usr/bin$ pip3 install librosa
WARNING: The directory '/home/usr/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/usr/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting librosa
  Downloading https://files.pythonhosted.org/packages/ad/6e/0eb0de1c9c4e02df0b40e56f258eb79bd957be79b918511a184268e01720/librosa-0.7.0.tar.gz (1.6MB)
     |████████████████████████████████| 1.6MB 1.3MB/s 
Collecting audioread>=2.0.0 (from librosa)
  Downloading https://files.pythonhosted.org/packages/2e/0b/940ea7861e0e9049f09dcfd72a90c9ae55f697c17c299a323f0148f913d2/audioread-2.1.8.tar.gz
Requirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.6/dist-packages (from librosa) (1.16.4)
Collecting scipy>=1.0.0 (from librosa)
  Downloading https://files.pythonhosted.org/packages/cb/97/361c8c6ceb3eb765371a702ea873ff2fe112fa40073e7d2b8199db8eb56e/scipy-1.3.0.tar.gz (23.6MB)
     |████████████████████████████████| 23.6MB 1.7MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Complete output from command /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpwycpd3kc:
    ERROR: lapack_opt_info:
    lapack_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      NOT AVAILABLE
    
    openblas_lapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      NOT AVAILABLE
    
    openblas_clapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
      NOT AVAILABLE

Upgrade the SETUP tools:

sudo pip3 install --upgrade setuptools
sudo pip3 install -U setuptools
sudo pip3 install cython
sudo pip3 install --upgrade pip

Install LLVM & LLVMLITE:

Before we install the LLVMLITE, LLVM-7 or above version is required. So install the llvm-7 or llvm-8 as below.

sudo apt-get install llvm-7
sudo pip3 install llvmlite 
sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran

Incase if this installation throws LLVM_CONFIG not found, then create the ln for the llvm-config-7 as below. Just ensure that you have llvm-config under /usr/bin path.

/usr/bin$ sudo ln -s llvm-config-7 llvm-config

Great! Now librosa will get easily install,

sudo pip3 install librosa

Collecting librosa
Downloading https://files.pythonhosted.org/packages/ad/6e/0eb0de1c9c4e02df0b40e56f258eb79bd957be79b918511a184268e01720/librosa-0.7.0.tar.gz (1.6MB)
|████████████████████████████████| 1.6MB 1.2MB/s 
Collecting audioread>=2.0.0 (from librosa)
Downloading https://files.pythonhosted.org/packages/2e/0b/940ea7861e0e9049f09dcfd72a90c9ae55f697c17c299a323f0148f913d2/audioread-2.1.8.tar.gz
Requirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.6/dist-packages (from librosa) (1.16.4)
Collecting scipy>=1.0.0 (from librosa)
Using cached https://files.pythonhosted.org/packages/cb/97/361c8c6ceb3eb765371a702ea873ff2fe112fa40073e7d2b8199db8eb56e/scipy-1.3.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting scikit-learn!=0.19.0,>=0.14.0 (from librosa)
Downloading https://files.pythonhosted.org/packages/57/5c/133b464c8d0be7ac8c9414b6ff2ae848808a35ce03b146fc2c43777e51f9/scikit-learn-0.21.2.tar.gz (12.2MB)
|████████████████████████████████| 12.2MB 1.5MB/s 
Collecting joblib>=0.12 (from librosa)
Downloading https://files.pythonhosted.org/packages/cd/c1/50a758e8247561e58cb87305b1e90b171b8c767b15b12a1734001f41d356/joblib-0.13.2-py2.py3-none-any.whl (278kB)
|████████████████████████████████| 286kB 1.5MB/s 
Requirement already satisfied: decorator>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from librosa) (4.4.0)
Requirement already satisfied: six>=1.3 in /usr/local/lib/python3.6/dist-packages (from librosa) (1.12.0)
Collecting resampy>=0.2.0 (from librosa)
Downloading https://files.pythonhosted.org/packages/14/b6/66a06d85474190b50aee1a6c09cdc95bb405ac47338b27e9b21409da1760/resampy-0.2.1.tar.gz (322kB)
|████████████████████████████████| 327kB 1.6MB/s 
Collecting numba>=0.38.0 (from librosa)
Downloading https://files.pythonhosted.org/packages/7e/89/853a1f03b09f1b13b59c3d785678b47daac6ddd24a285f146d09bb723b85/numba-0.45.0.tar.gz (1.8MB)
|████████████████████████████████| 1.8MB 1.8MB/s 
Collecting soundfile>=0.9.0 (from librosa)
Downloading https://files.pythonhosted.org/packages/68/64/1191352221e2ec90db7492b4bf0c04fd9d2508de67b3f39cbf093cd6bd86/SoundFile-0.10.2-py2.py3-none-any.whl
Requirement already satisfied: llvmlite>=0.29.0dev0 in /usr/local/lib/python3.6/dist-packages (from numba>=0.38.0->librosa) (0.29.0)
Collecting cffi>=1.0 (from soundfile>=0.9.0->librosa)
Downloading https://files.pythonhosted.org/packages/93/1a/ab8c62b5838722f29f3daffcc8d4bd61844aa9b5f437341cc890ceee483b/cffi-1.12.3.tar.gz (456kB)
|████████████████████████████████| 460kB 1.5MB/s 
Collecting pycparser (from cffi>=1.0->soundfile>=0.9.0->librosa)
Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
|████████████████████████████████| 163kB 1.4MB/s 
Building wheels for collected packages: scipy
Building wheel for scipy (PEP 517) ... done
Created wheel for scipy: filename=scipy-1.3.0-cp36-cp36m-linux_aarch64.whl size=39879948 sha256=81dcdf1c6482e268de7e0e745c946c40e7ec271aca06a4ac46030c769300bea6
Stored in directory: /home/danata/.cache/pip/wheels/58/c7/8f/6e0f7d9c19f1b28b317b3c22e2af7131f2834db64f5828b9ee
Successfully built scipy
Building wheels for collected packages: librosa, audioread, scikit-learn, resampy, numba, cffi, pycparser
Building wheel for librosa (setup.py) ... done
Created wheel for librosa: filename=librosa-0.7.0-cp36-none-any.whl size=1599560 sha256=396b828224b4deb2d13a3e74fca92106c9f429d64b99e33551b2af8a95022cbf
Stored in directory: /home/danata/.cache/pip/wheels/49/1d/38/c8ad12fcad67569d8e730c3275be5e581bd589558484a0f881
Building wheel for audioread (setup.py) ... done
Created wheel for audioread: filename=audioread-2.1.8-cp36-none-any.whl size=26091 sha256=d4af58e8126a3b259f340fe43a9cf3701fa1650285020c432a313d2750847da8
Stored in directory: /home/danata/.cache/pip/wheels/b9/64/09/0b6417df9d8ba8bc61a7d2553c5cebd714ec169644c88fc012
Building wheel for scikit-learn (setup.py) ... done
Created wheel for scikit-learn: filename=scikit_learn-0.21.2-cp36-cp36m-linux_aarch64.whl size=16007990 sha256=fce3ea10996c5dc8c66f62cbcc0517c58d3f76a5d502cbbf81d57dd6c4e50441
Stored in directory: /home/danata/.cache/pip/wheels/58/f0/f6/27e0c1fb17f342b9aeef7b2592f1e7ed96fd2536f71a90bb16
Building wheel for resampy (setup.py) ... done
Created wheel for resampy: filename=resampy-0.2.1-cp36-none-any.whl size=321176 sha256=c9d4dd261f54e1915562e327278510f17616bb779f956d897e324613b9645787
Stored in directory: /home/danata/.cache/pip/wheels/ff/4f/ed/2e6c676c23efe5394bb40ade50662e90eb46e29b48324c5f9b
Building wheel for numba (setup.py) ... done
Created wheel for numba: filename=numba-0.45.0-cp36-cp36m-linux_aarch64.whl size=2557794 sha256=6b1ab9e8f5d4d5ff1003c7eb6ae9eb338056bf0f9424b4efc6aadd5b8685bea9
Stored in directory: /home/danata/.cache/pip/wheels/51/5d/c0/420ea2fced22bb1702a294c2cbc0dcaefd6ed61f3d6253fd61
Building wheel for cffi (setup.py) ... done
Created wheel for cffi: filename=cffi-1.12.3-cp36-cp36m-linux_aarch64.whl size=325260 sha256=0c9eba3a99fca1894dbd37a3fb04897edc42826d788cfacd19070fbd8c03743b
Stored in directory: /home/danata/.cache/pip/wheels/94/a7/7a/9782ab473d88ec2d4994a7dd2d006b1352c71da3ad34ebcaeb
Building wheel for pycparser (setup.py) ... done
Created wheel for pycparser: filename=pycparser-2.19-py2.py3-none-any.whl size=112040 sha256=04c0d1d7b118a88615851243c4ce7d026cc4fbcfc358f5daca370a0f34b96ebf
Stored in directory: /home/danata/.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
Successfully built librosa audioread scikit-learn resampy numba cffi pycparser
Installing collected packages: audioread, scipy, joblib, scikit-learn, numba, resampy, pycparser, cffi, soundfile, librosa
Successfully installed audioread-2.1.8 cffi-1.12.3 joblib-0.13.2 librosa-0.7.0 numba-0.45.0 pycparser-2.19 resampy-0.2.1 scikit-learn-0.21.2 scipy-1.3.0 soundfile-0.10.2

Hope, it helps you. Now go ahead and do all your wonderful deep learning projects that related to sounds. All the best.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s