Home > OS >  How to specify a wheel in Heroku for Flask app?
How to specify a wheel in Heroku for Flask app?

Time:12-31

I need pyaudio for the speech recognition library and I am using python 3.7.9, I used the PyAudio-0.2.11-cp37-cp37m-win_amd64 wheel. I can install pyaudio locally using pip and the wheel and it worked fine. How do I do this in a requirements.txt for a Heroku Flask web app?

CodePudding user response:

I can connect my Heroku flask app with GitHub and add the wheel in the same repo as my code. Then I can just paste the path in requirments.txt.

For example, if this is my requirement.txt:

dlib==19.22.1
Flask==2.0.2
imutils==0.5.4
opencv_python==4.5.4.60
scipy==1.7.3
gunicorn==20.1.0
pyaudio==0.2.11

I could add the wheel at the top for pyaudio to make the requirement.txt look like this:

PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
dlib==19.22.1
Flask==2.0.2
imutils==0.5.4
opencv_python==4.5.4.60
scipy==1.7.3
gunicorn==20.1.0
pyaudio==0.2.11

In some cases, you might get the error from Heroku that they do not support that specific wheel.

  • Related