How to use soundfile on heroku

后端 未结 2 644
野趣味
野趣味 2020-12-21 10:53

I have a python flask app I\'m running on Heroku which uses the soundfile library. After adding soundfile to requirements.txt Heroku gave me this e

相关标签:
2条回答
  • 2020-12-21 11:32

    Create an 'Aptfile' and add the following lines:

    libasound2-dev python-dev python-numpy python-setuptools libsndfile-dev

    This worked for me.

    0 讨论(0)
  • 2020-12-21 11:33

    libsndfile1 isn't a Python library, so you can't install it via requirements.txt.

    One way to get this working is to use the apt buildpack alongside the Python buildpack:

    1. Remove libsndfile1 from your requirements.txt

    2. Configure your application to use two buildpacks:

      heroku buildpacks:set heroku/python
      heroku buildpacks:add --index 1 heroku-community/apt
      heroku buildpacks
      # Should show apt first, then python
      
    3. Add an Aptfile listing Ubuntu packages to be installed:

      libsndfile1
      
    4. Commit your changes and push to deploy. You should see apt packages installed first, then your regular Python deployment.

    0 讨论(0)
提交回复
热议问题