13

I am trying to work with PIL in my project but the pydev can't seem to find it in my project. First of all I can see it when I enter the python shell, I can import it and I see it in the python sys.path. Second, I Added it to the PYTHONPATH in eclipse.

I restarted eclipse, but still, when I try to do "from PIL import Image" I am getting: "unresolved import".

Can any one please help me here, all other packages I used until now worked great the same way.... and i really need to use PIL

Erez
  • 1,933
  • 5
  • 29
  • 56
  • 1
    Is this your first attempt at using pydev? It sounds like your interpreter is not assigned properly. check window->preferences->pydev->Interpreter - Python, and make sure you have the python installation loaded there for the version you installed PIL into. – monkut May 30 '11 at 02:59
  • No, sorry, i am working with eclipse and pydev for a long time, i installed many packages before and they all worked great, just this one is cousing me all the headache.....so i guess i am doing some things right, and one thing wrong somewhere, just don't know where as for all the other packages every things is working great – Erez May 30 '11 at 03:08
  • I would check that PIL is in the python installation that you have set as your interpreter in the project. – monkut May 30 '11 at 04:37
  • does your file compile when you add the import? – James Khoury May 30 '11 at 07:11
  • Well, It's kind of a moo point at this stage, but thanks guys, the thing is, as i said that on the server i have PIL and it is working, so that is not the problem, the problem is only with the pydev in eclipse, is i am getting unresolved errors, never mind, i waisted too much time on this, I don't really care anymore about the unresolved, and working with it.... thanks anyway :-) – Erez May 30 '11 at 09:56

2 Answers2

10

Try to go to Window -> Preferences -> Pydev-> Interpreter -> Python Interpreter -> Forced Builtins tab. Then add a PIL entry and apply. I've had the same unresolved import error when tried to import from this particular package (other packages worked fine), and found this information which finally helped me.

Community
  • 1
  • 1
Dzejkob
  • 2,302
  • 2
  • 15
  • 20
9

Had the same problem here. Got it resolved by adding /usr/share/pyshared to the Libraries tab in window->preferences->pydev->Interpreter - Python.

There were a lot of /usr/lib/python* paths with the compiled libraries (the C stuff with python bindings) where included already, but not /usr/share... parts with the source.

Henrik
  • 106
  • 1
  • 10x, I actually got it working, the thing is that for some reason in PyDev it show like there is no PIL, but it is working ok, so I just ignored it, i even can import and use every things from PIL, just getting an error like the PIL is not there....but 10x anyway, this is good :-) – Erez Jun 27 '11 at 00:06
  • Which Linux distribution was this? – user240515 Mar 27 '12 at 22:06