Heroku: ModuleNotFoundError :No module named ‘requests’

The output from your Heroku build shows that you have a Pipfile and Pipfile.lock in addition to your requirements.txt.

You need to choose between using pip (using requirements.txt) or Pipenv (using Pipfile and Pipfile.lock). If all three files are present, Heroku will install with Pipenv, ignoring your requirements.txt file.

Either

  • move your requirements to your Pipfile and run Pipenv locally to install them and update your Pipfile.lock, delete your requirements.txt, commit, and push (to use Pipenv), or
  • delete the Pipfile and Pipfile.lock, use pip (or pip-tools or similar) locally, commit, and push (to use pip).

Leave a Comment