Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

error message: Cannot find Python Imaging Library (PIL or Pillow) #3

Open
Wagyx opened this issue Mar 7, 2014 · 5 comments
Open

error message: Cannot find Python Imaging Library (PIL or Pillow) #3

Wagyx opened this issue Mar 7, 2014 · 5 comments

Comments

@Wagyx
Copy link

Wagyx commented Mar 7, 2014

Hello,
I am trying to run the lfp functions on ubuntu 12.04.4 and I am facing this error message when i run lfp-pictures.py export *.lfp
which is weird because PIL is already installed, it seems that some path must be wrong somewhere which should not happen on ubuntu.
I read #2 but it seems to be dead because no one has answered for 4 months.
I did the ipython thing and i got
module 'Image' from '/usr/lib/python2.7/dist-packages/PIL/Image.pyc'
compared to the creator setup PILcompat became PIL

Any advice to help me find the solution is appreciated
thank you

@Wagyx
Copy link
Author

Wagyx commented Mar 7, 2014

I found the solution,
follow those instructions to uninstall pil and install pillow instead
http://pythonadventures.wordpress.com/2013/05/19/problems-with-pil-use-pillow-instead/
(don't forget to test if the "import Image" fails and "from PIL import Image" wins in a python command line that's the main aspect of the solution.

optional:use the command "pip freeze" to check if it was correctly uninstalled

I also had to remove pil from the packages with the command sudo apt-get remove python-imaging

finally you have to modify the _utils.py under the lfp-reader folder

if sys.hexversion < 0x03000000:
#import Image as pil #for pil library only
#import ImageTk as piltk #for pil library only
from PIL import Image as pil #for pillow library only
from PIL import ImageTk as piltk #for pillow library only

then it should work, at least it worked for me

@behnam
Copy link
Owner

behnam commented Mar 7, 2014

Thanks Wagyx for investigating. What I had there was working for me at the time, so I think we better stay inclusive and allow both packaging methods.

Anyway, could you please send a patch/merge-request?

@Wagyx
Copy link
Author

Wagyx commented Mar 10, 2014

You're welcome. This code is very helpful for my project on the Lytro camera, so thank you too.

I think I have done it correctly but as I am new to Github I first thought I made a mistake and did the commit 3 times in total.
Please let me know if I have done anything wrong, I'll correct it right away.

@TheFullMoon
Copy link

After running lfp-viewer.py, I received several lines with the following message at the end:
from _.utils.py import(
ImportError: cannot import name 'pil'
This happens after I modified _utils.py as @Wagyx suggested. Before that it was the same problem. I'm running it on Windows and the Python version is 3.4, The 'samples' folder are put under the same folder with lfp-viewer.py(Python34/Scripts). Thank you.

@TheFullMoon
Copy link

Thank you @behnam for the update. It now works very well with Python 2.

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

No branches or pull requests

3 participants