13👍
Every command you run on Heroku is run in an isolated and ephemeral environment — any changes you make during heroku run
are thrown away immediately when the processes completes.
To make PIL available to your application, you need to add it to requirements.txt
instead.
1👍
Are you sure you have followed http://devcenter.heroku.com/articles/django#prerequisites and your virtualenv is loaded?
BTW, I recommend using Pillow instead of PIL.
Introduction
The fork author’s goal is to foster packaging improvements via:
Publicized development and solicitation of community support.
Exploration of packaging problems within the fork, most noticably via
adding setuptools support but also via clean up & refactoring of
packaging code. Why a fork?PIL is currently not setuptools compatible. Please see
http://mail.python.org/pipermail/image-sig/2010-August/006480.html for
a more detailed explanation. Also, PIL’s current release/maintenance
schedule is not compatible with the various & frequent packaging
issues that have occured.
1👍
Sometimes PIL package is added in your path but it’s somewhere else than in site-packages. In this case you will be able to just import Image
.
To make sure try something like this:
>>> import sys
>>> sys.path
[(...), '/usr/lib/python2.7/dist-packages/PIL', (...)]
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Image
>>> Image
<module 'Image' from '/usr/lib/python2.7/dist-packages/PIL/Image.pyc'>
In my applications I use code like this:
try:
import Image, ImageDraw, ImageFont
except:
from PIL import Image, ImageDraw, ImageFont
- [Django]-Django & Nginx deeplinking domains (re-write rules or django urls?)
- [Django]-Django migration dependency order
- [Django]-__init__() missing 1 required positional argument: 'model_field'
1👍
Even i was facing the same issue, I spent quite a lot of time.
I tried this
heroku run pip install PIL --app=your-app
error:
Running `pip install PIL` attached to terminal... up, run.1983
Downloading/unpacking PIL
Could not find any downloads that satisfy the requirement PIL
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /app/.pip/pip.log
But this helps like a charm 🙂
heroku run pip install Pillow --app=your-app
- [Django]-How to allow editing of templates for email by admin user in Django?
- [Django]-MongoDB storage along with MySQL XPath features
- [Django]-Save user with generated password with Django
- [Django]-Django send_mail returns SMTPConnectError