Results 1 to 2 of 2

Thread: Problem importing Python libraries installed with PIP in Eclipse

  1. #1

    Default Problem importing Python libraries installed with PIP in Eclipse

    Hi guys, I'm using Python 2.7.5 64 bits in OpenSUSE 13.1 and I have a problem when importing libraries that were installed via PIP when importing them inside Eclipse (version 4.3.1). Outside Eclipse (directly in Python's shell) everything works fine, here is an example:


    Code:
    >>> import numpy                             # installed from repositories
    >>> from numpy import array
    >>> import pybrain                           # installed via PIP
    >>> from pybrain import Network
    >>>
    Everything works outside Eclipse. But inside Eclipse I can't import libraries installed via PIP using "from x import y" format, it will give an error. The only way I can import libraries installed via PIP is using "import x" format. Here is an example:


    Code:
    import numpy                                     # no errors (installed from repositories)
    from numpy import array                          # no errors
    import pybrain                                   # no errors (installed via PIP)
    from pybrain import Network                      # gives the error below
    
    
    Traceback (most recent call last):
      File "/media/arquivos/pybrain_import_test.py", line 4, in <module>
        from pybrain import Network
    ImportError: cannot import name Network
    I suspected it could be related to virtualenv, but here is a print screen of my Python's PATH. The directory /usr/lib/python2.7/site-packages where PyBrain is installed is already in Python's PATH inside Eclipse. Could someone help me, please?

  2. #2

    Default Re: Problem importing Python libraries installed with PIP in Eclipse

    It's solved now, oh my god I was so stupid! I created a package named "pybrain" for testing PyBrain module, so obviously when I tryed to import something from PyBrain library, Python would import all modules from this personal package I created. The problem was not being reproduced outside Eclipse because only within Eclipse my personal workstation directory (which contained the personal package "pybrain") was visible. The solution was simple: I just deleted the personal package named "pybrain" and now everything is working.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •