0

I am deploying a Flask app of Heroku that uses librosa, but when I run the app, I get an H10 error. I went back into the logs and got this error, which is likely the cause of the H10 error:

2021-07-17T13:06:17.447032+00:00 app[web.1]: OSError: sndfile library not found

requirements.txt:

git+https://github.com/CPJKU/madmom.git
ffmpeg==1.4
Flask==1.1.2
Jinja2==2.11.3
librosa==0.8.0
numpy==1.17.5
youtube-dl==2021.4.17
gunicorn==20.1.0

I've tried to install libsndfile1, tried to install librosa with conda, and tried to install librosa with homebrew (I am on MacOS) but none of those methods have worked.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
teleriffr
  • 11
  • 3
  • can you paste the content your requirements.txt file by editing the question – charchit Jul 17 '21 at 14:15
  • @charchit requirements.txt is now in question – teleriffr Jul 17 '21 at 17:35
  • Have you checked this question https://stackoverflow.com/a/57746160/15011621 – charchit Jul 17 '21 at 18:38
  • @charchit I tried the first solution in the question you linked and that did not work, but the second one got rid of the `OSError: sndfile library not found` message, so thank you for that. However, my app is still crashing, but this time, it gives the following error: `ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject` I think this has something to do with the madmom package. Do you know a way to fix this error? Thanks! – teleriffr Jul 18 '21 at 13:30
  • I had the same issue but in my local machine, I followed this answer, it solved. https://stackoverflow.com/a/66066058/15011621 – charchit Jul 18 '21 at 14:05

1 Answers1

0

When needing custom Linux dependencies on Heroku, I recommend switching to using Docker instead of Heroku buildpacks. Then you can get the same environment locally as you run on your servers. Here is the official Heroku documentation on deploying with Docker.

For using librosa et.c you can base your Docker image on the offical Python Docker image. If you use one of the Debian variants, then you can install sndfile using sudo apt-get install -yqq libsndfile1 libsndfile1-dev. Note that this should be done before installing Python dependencies with pip.

Jon Nordby
  • 5,494
  • 1
  • 21
  • 50