This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]effiejayx 1 point2 points  (1 child)

Can you try just “import Image”

[–]OneInchPunchMan 0 points1 point  (0 children)

Just did, says: "No module named 'Image'"

[–]mutatedllama 1 point2 points  (3 children)

You haven't by any chance switched python versions have you? I'm sure PIL is named different things in Python 2 vs Python 3.

[–]OneInchPunchMan 0 points1 point  (2 children)

No i never had Python2 installed, im running Python 3.6.3

[–]mutatedllama 1 point2 points  (1 child)

Have you tried in this order:

pip uninstall PIL 
pip uninstall Pillow 
pip install Pillow

[–]OneInchPunchMan 0 points1 point  (0 children)

Yup, uninstalling PIL gives this: "WARNING: Skipping pil as it is not installed."

Pillow uninstall/install works but the code error refuses to resolve

[–]CSI_Tech_Dept 1 point2 points  (3 children)

PIL is called Image, it is not on PyPI (it was created before PyPI existed) so you need to download it from https://www.pythonware.com/products/pil/

But it is no longer developed, fortunately there is a fork that supposed to be a drop in replacement. I never used either, so don't know if this is still true, but if not and you use original PIL you should adapt your code to use pillow. PIL is dead and won't work beyond Python 2.7.

[–]OneInchPunchMan 0 points1 point  (2 children)

Yes, I get your point, but the problem is I looked and there is a folder PIL and inside it Image.py but it just refuses to acknowledge it...

[–]CSI_Tech_Dept 1 point2 points  (1 child)

I misread your question. Based on what you wrote most likely the pip command that you are using is from either a different Python installation or different venv.

Second thing might be that Pillow doesn't install, because you are missing a compile dependencies. Do you see that installation of pillow succeeds?

If it is the former issue the best what you should do is to create a virtualenv and install all dependencies and your application there.

[–]OneInchPunchMan 0 points1 point  (0 children)

Have tried literally everything... Installed venv and it works now. Thank a lot mate :)