I’m deploying something that has been running on my local and realized when I deployed that the module I was using wasn’t installed on Heroku, thus I was getting an error like this:
...
from PIL import Image
ImportError: No module named PIL
I’ve tried:
heroku run pip install PIL
but I’m getting this:
ImportError: No module named setuptools.command
edit
So, I went to the heroku setup and mimicked the steps to install django and postgres. Essentially, I activated the environment and then ran
pip install PIL
This seemed to be doing the trick, I got a lot of readout and then it ended with a confirmation that PIL had been installed. But then again, it said it couldn’t find PIL when I ran the new file.
Every command you run on Heroku is run in an isolated and ephemeral environment — any changes you make during
heroku runare thrown away immediately when the processes completes.To make PIL available to your application, you need to add it to
requirements.txtinstead.