Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named PIL #14

Closed
jazzsequence opened this issue Jan 17, 2012 · 11 comments
Closed

ImportError: No module named PIL #14

jazzsequence opened this issue Jan 17, 2012 · 11 comments

Comments

@jazzsequence
Copy link

OSX 10.7.2

Homebrew wasn't installed (even though Xcode was), so I installed that manually. No problem with the brew install jpeg.

sudo pip install glue gave me a sudo: pip: command not found so ran the sudo easy_install glue
That worked, but whenever I invoke glue I get:

Traceback (most recent call last):
  File "/usr/local/bin/glue", line 8, in <module>
    load_entry_point('glue==0.1.9', 'console_scripts', 'glue')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2221, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/Library/Python/2.7/site-packages/glue-0.1.9-py2.7.egg/glue.py", line 11, in <module>
    from PIL import Image as PImage
ImportError: No module named PIL

Any help?

@jorgebastida
Copy link
Owner

Try to install PIL, easy_install PIL

I'll check if there is any issue installing glue using easy_install

Thanks!

@jazzsequence
Copy link
Author

No dice.

Searching for PIL
Best match: PIL 1.1.7
Processing PIL-1.1.7-py2.7-macosx-10.7-intel.egg
PIL 1.1.7 is already the active version in easy-install.pth
Installing pilconvert.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin
Installing pilfile.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin

Using /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.7-intel.egg
Processing dependencies for PIL
Finished processing dependencies for PIL

still get the No module named PIL when I try to run glue :/

@jorgebastida
Copy link
Owner

Open a python console and type from PIL import Image if nothing happens... this is a glue bug, if not it seems that PIL isn't properly installed. Let me know what happens.

@jazzsequence
Copy link
Author

Yep. That was it. I got PIL installed and now glue works. Woo! Thanks :) This will help me a ton.

@jazzsequence
Copy link
Author

For future reference, I went through these steps to get PIL working: http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html

@jorgebastida
Copy link
Owner

Thank you very much @jazzsequence !

@dlowe
Copy link

dlowe commented Jul 13, 2012

This seems to be a bit more complicated than you might guess.

PIL's packaging is a bit of a mess -- see e.g. http://mail.python.org/pipermail/image-sig/2010-August/006480.html. In particular, for many folks from PIL import Image will not work; they need import Image.

Various OS distros and users have apparently responded with fixes and alternate packagings, but the official package is still a mess. My personal current workaround is to use the 'Pillow' package instead (http://pypi.python.org/pypi/Pillow). For 'glue', though, it might be nice to have a fallback import e.g.:

try:
    from PIL import Image
except:
    import Image

@jorgebastida
Copy link
Owner

Sounds like a good plan @dlowe

What about this #45 ? Should Glue require Pillow instead of Pil ?

thoughts?

@jorgebastida jorgebastida reopened this Jul 14, 2012
@dlowe
Copy link

dlowe commented Jul 14, 2012

That would help your users avoid the gnarly problems that can occur installing PIL directly, yep.

@jorgebastida
Copy link
Owner

After 0.2.7 Glue will require Pillow and not Pil, so this issue should be fixed now.
I'm going to update the documentation with your tips.

Thank you guys!

@jorgebastida
Copy link
Owner

I've just released glue 0.2.7 and now requires Pillow instead of PIL.

Thank you very much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants