cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Issue in importing librosa library while using databricks runtime engine 11.2

Chandru
New Contributor III

I have installed the library via PyPI on the cluster. When we import the package on notebook, getting the following error

import librosa

OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory

1 ACCEPTED SOLUTION

Accepted Solutions

-werners-
Esteemed Contributor III

it seems the linux OS is missing the libsndfile package.

This is apparently a dependency of librosa.

This can be done by using an init script:

https://docs.databricks.com/clusters/init-scripts.html#cluster-scoped-init-scripts

View solution in original post

3 REPLIES 3

-werners-
Esteemed Contributor III

it seems the linux OS is missing the libsndfile package.

This is apparently a dependency of librosa.

This can be done by using an init script:

https://docs.databricks.com/clusters/init-scripts.html#cluster-scoped-init-scripts

Chandru
New Contributor III

Thank you werners. Just figured that out and had an init script to sort out the issue. Below steps helped me to solve the issue.

dbutils.fs.mkdirs("dbfs:/cluster-init/scripts/")

dbutils.fs.put("/cluster-init/scripts/libsndfile-install.sh","""

#!/bin/bash

apt-get --yes install libsndfile1

""", True)

and added init script for the cluster as

dbfs:/cluster-init/scripts/libsndfile-install.sh

Flo
New Contributor III

If anybody ends up here after 2024: the init file must now be placed in the workspace for the cluster to accept it.

So in Workspace, use Create/File to create the init script.

Then add it to the cluster config in
Compute - Your cluster - Advanced Config - init scripts

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group