Pydev unresolved import errors

June 12, 2009...... at 3:21 pm | Posted in geek | 37 Comments

For those seeing a lot of Pydev unresolved import errors the problem is related to the fact that pydev doesn’t seem to register nested modules. So if your package contains a package which contains a module, unless the parents of both packages appears on the Pythonpath, pydev will hit you with an unresolved import error. To make it go away you have 2 choices:
1. Add the parent to the python path
2. Click Ctl + 1 and select Unresolved import error

37 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Thanx mate. That’s been a botherin’ me fer awhile now. If I upgrade my PyDev version would that help too? (I haven’t done it because I’m scared I’m going to have to pay for the upgrade!)..

    (Eclipse Version: 3.4.1, PyDev version: 1.3.22).

  2. pydev is open source now, so you shouldn’t have to pay. The easiest way to turn it off is in the Eclipse Preferences “Pydev / Editor / Code Analysis”.

  3. Cool trick! Thanks!

    • Thanks. I spent hours re-installing and looking for configuration files. Following your advice 2 mins solved the problem

  4. I added parent directory of both modules, but am still getting that error. What else could it be?

    • My problem went away by removing the default interpreter and adding it back again. It seems I upgraded Django and somehow it went away from the _builtins_.

      Abhaya

      • This worked for me. It was having issues with libs I’d installed after installing pydev. This fixed it.

  5. Thanks for that too! This has been driving me mad for ages and Ctrl 1 did the trick.

  6. Great, this really helps!!!

  7. in my case, I downloaded ‘Eclipse IDE for JavaScript Web Developers’ and did the following step: help menu->install new software.. then add ‘http://pydev.org/updates’. next is restart.

    did this:

    import random
    number = random.randint(1, 10)
    print(number)

    I didnt have issue like: unresolved import errors which i encountered in Eclipse Classic 3.6.0.

    • Awesome find! This helped me out too.

  8. None of this fixed anything and most was not even applicable – is this particular to, e.g., Windows? I have Eclipse Helios on OS X, and I installed the Aptana Eclipse plug-in version because at the PyDev download it said I needed that for django templates.

    What I’ve gotten out of PyDev so far is endless unresolved import module errors regardless of any steps I take to turn them off, etc., making any project i do in PyDev just annoying, not worthwhile. My verdict on PyDev is I’ll avoid it, and hope there’s something better for Eclipse somewhere else. Meanwhile, I edit my Python code in BBEdit.

    The EPIC for Perl is not half the hassle this crap is, frankly.

  9. same here, i did everything- but i am still getting unresolved imports. decided not to use pydev anymore. annoying

  10. really nice, saved my time

  11. The only thing for me that solved the issue was to completely delete (window->preferences->pydev->interpreter python->remove) and then adding it again with Auto Config.

    Regards

    • Hi, Guys, you are very perfect, 3X & 3Q.

    • That did the trick, thanks!

    • That worked for me as well. Nothing else was of help.

      • Nice!!! It worked, thank you very much

  12. Installed Pyro and Eclipse couldnt import it. I did the same thing as Lpaq and reloaded my workspace and it works now.

  13. I added the folder to “System PYTHONPATH” under the “Libraries” tab at (window->preferences->pydev->interpreter python) and my problem was resolved.

  14. What worked for me was to remove the PyDev interpreter from Eclipse and re-add it using auto config. Thanks for the post!

  15. Many thanks!
    It worked 🙂

  16. My solution is rather simple:
    configure into Python Interpreters->Libraries
    remove “C:\Python27\lib\site-packages”
    then add “C:\Python27\Lib\site-packages”
    all problem solved….

  17. hi!,I really like your writing so a lot! percentage we be in contact extra about your post on AOL?
    I require a specialist on this house to unravel
    my problem. Maybe that’s you! Taking a look forward to look you.

  18. Thank you very much. Ctrl + 1 did the trick for me. I had a problem with : from scapy.all import IP,send

  19. REAL SOLUTION:
    Project->Properties->PyDev – PYTHONPATH->Force restore internal info

  20. Hi,

    Tried all the solutions in the comments and no luck, any suggestions or corrections to steps I took? I tried the following, Each time I restart eclipse and still shows the unresolved import error.
    1)
    remove “C:\Python27\lib\site-packages”
    then add “C:\Python27\Lib\site-packages”
    No go
    2)
    Remove the interpreter
    (window->preferences->pydev->interpreter python->remove)
    adding it again with Auto Config
    No go
    3)
    window->preferences->pydev->interpreter python->libraries
    Added:
    c:\python27\Lib\site-packages\lxml
    No go
    4)
    Project->Properties->PyDev – PYTHONPATH->Force restore internal info
    No go

  21. […] PyDev unresolved import issue solution […]

  22. […] PyDev unresolved import issue solution […]

  23. adding ${GOOGLE_APP_ENGINE}/lib/webapp2-2.5.2 to the “External Libraries” worked for me.
    App Engine SDK ver:1.8.2
    Python version: 2.7

  24. In my case the unresolved Python modules were located in sibling directories under the ‘src’ directory, which was in turn a top-level directory within the project directory. PyDev was able to resolve the modules once the src dir was explicitly added to the PYTHON_PATH in the project properties. Similarly, unresolved external dependencies were resolved by adding them to the python path via the external libraries tab, although it took some trial and error to identify the exactly ho much of the path to include in order to achieve this.

  25. Thanks for the posting. It does help me.

  26. Thank you, brother!

  27. 6u25s2804lwsxypm6oil


Leave a reply to Random Guy Cancel reply

Blog at WordPress.com.
Entries and comments feeds.