Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66277 > unrolled thread

Problem importing libraries installed with PIP in Eclipse

Started byRenato <rvernucio@gmail.com>
First post2014-02-13 19:30 -0800
Last post2014-02-17 16:20 -0300
Articles 6 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Problem importing libraries installed with PIP in Eclipse Renato <rvernucio@gmail.com> - 2014-02-13 19:30 -0800
    Re: Problem importing libraries installed with PIP in Eclipse Fabio Zadrozny <fabiofz@gmail.com> - 2014-02-15 16:25 -0200
    Re: Problem importing libraries installed with PIP in Eclipse Renato <rvernucio@gmail.com> - 2014-02-16 04:59 -0800
    Re: Problem importing libraries installed with PIP in Eclipse Renato <rvernucio@gmail.com> - 2014-02-16 06:52 -0800
      Re: Problem importing libraries installed with PIP in Eclipse Fabio Zadrozny <fabiofz@gmail.com> - 2014-02-17 16:07 -0300
      Re: Problem importing libraries installed with PIP in Eclipse Renato Vernucio <rvernucio@gmail.com> - 2014-02-17 16:20 -0300

#66277 — Problem importing libraries installed with PIP in Eclipse

FromRenato <rvernucio@gmail.com>
Date2014-02-13 19:30 -0800
SubjectProblem importing libraries installed with PIP in Eclipse
Message-ID<3a3acbf3-a7a5-4a5f-9e6c-10b4640be17f@googlegroups.com>
Hi guys, I'm using Python 2.7.5 64 bits 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:

>>> 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:

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 (http://imageshack.com/a/img534/4307/3x0m.png) 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?

[toc] | [next] | [standalone]


#66468

FromFabio Zadrozny <fabiofz@gmail.com>
Date2014-02-15 16:25 -0200
Message-ID<mailman.7015.1392488743.18130.python-list@python.org>
In reply to#66277

[Multipart message — attachments visible in raw view] — view raw

On Fri, Feb 14, 2014 at 1:30 AM, Renato <rvernucio@gmail.com> wrote:

> Hi guys, I'm using Python 2.7.5 64 bits 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:
>
> >>> 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:
>
> 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 (
> http://imageshack.com/a/img534/4307/3x0m.png) 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?
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Hi Renato,

Can you do the following:

Create a new script with:

import sys
print '\n'.join(sorted(sys.path))

And let me know if the paths you have listed in both are equal... Also,
which version of PyDev are you using?

Cheers,

Fabio

[toc] | [prev] | [next] | [standalone]


#66529

FromRenato <rvernucio@gmail.com>
Date2014-02-16 04:59 -0800
Message-ID<e6eab0df-5d7e-47fe-9f67-bf5542255af7@googlegroups.com>
In reply to#66277
Em sexta-feira, 14 de fevereiro de 2014 01h30min05s UTC-2, Renato  escreveu:
> Hi guys, I'm using Python 2.7.5 64 bits 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:
> 
> 
> 
> >>> 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:
> 
> 
> 
> 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 (http://imageshack.com/a/img534/4307/3x0m.png) 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?


Fabio, thanks for your reply. I'm using PyDev version 2.7.0.2013032300, the one who comes with Aptana Studio plugin for Eclipse. Here is Eclipse output:

/media/arquivos/Documentos/Programacao/Source/workspace_linux/Testes em Python/src
/media/arquivos/Documentos/Programacao/Source/workspace_linux/Testes em Python/src/pip_eclipse
/usr/lib/python2.7/site-packages
/usr/lib/python27.zip
/usr/lib64/python2.7
/usr/lib64/python2.7/lib-dynload
/usr/lib64/python2.7/lib-old
/usr/lib64/python2.7/lib-tk
/usr/lib64/python2.7/plat-linux2
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/PIL
/usr/lib64/python2.7/site-packages/gtk-2.0
/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode
/usr/local/lib/python2.7/site-packages
/usr/local/lib/python2.7/site-packages
/usr/local/lib64/python2.7/site-packages
/usr/local/lib64/python2.7/site-packages

And here is Python shell output:

/usr/lib/python2.7/site-packages
/usr/lib/python27.zip
/usr/lib64/python2.7
/usr/lib64/python2.7/lib-dynload
/usr/lib64/python2.7/lib-old
/usr/lib64/python2.7/lib-tk
/usr/lib64/python2.7/plat-linux2
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/PIL
/usr/lib64/python2.7/site-packages/gtk-2.0
/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode
/usr/local/lib/python2.7/site-packages
/usr/local/lib64/python2.7/site-packages

They are almost exactly the same, the only difference is that Eclipse includes the directory I'm running the script and print twice the last 2 directories.

[toc] | [prev] | [next] | [standalone]


#66541

FromRenato <rvernucio@gmail.com>
Date2014-02-16 06:52 -0800
Message-ID<b8e939ac-73e3-422b-900f-439100817c54@googlegroups.com>
In reply to#66277
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. Thank you very much for your help!

[toc] | [prev] | [next] | [standalone]


#66619

FromFabio Zadrozny <fabiofz@gmail.com>
Date2014-02-17 16:07 -0300
Message-ID<mailman.7108.1392664065.18130.python-list@python.org>
In reply to#66541

[Multipart message — attachments visible in raw view] — view raw

On Sun, Feb 16, 2014 at 11:52 AM, Renato <rvernucio@gmail.com> wrote:

> 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. Thank you very much for your help!
>


Hi Renato,

Nice that you got it working...

Now, just as a heads up, that version of PyDev is quite old (the latest
PyDev release: 3.3.3 is in many ways improved when comparing to older PyDev
versions). I know Aptana Studio still has the older version, so, if you use
mostly Python and you don't need the other features that Aptana Studio
adds, it might be worth going to pure Eclipse + PyDev (or using LiClipse
which also adds support for other languages -- besides being better
configured out of the box, although it's a commercial counterpart of PyDev
-- whose funds help to keep PyDev development going forward).

Cheers,

Fabio

[toc] | [prev] | [next] | [standalone]


#66622

FromRenato Vernucio <rvernucio@gmail.com>
Date2014-02-17 16:20 -0300
Message-ID<mailman.7109.1392664832.18130.python-list@python.org>
In reply to#66541

[Multipart message — attachments visible in raw view] — view raw

Hi Fabio,

I wish I could use the latest PyDev, unfortunately I need Aptana studio.
It's a pity they won't let us install individual packages from their
bundle. If they did, I could install only the other packages and install
PyDev separately.

Thanks for your help once again.

Yours,
Renato


2014-02-17 16:07 GMT-03:00 Fabio Zadrozny <fabiofz@gmail.com>:

>
> On Sun, Feb 16, 2014 at 11:52 AM, Renato <rvernucio@gmail.com> wrote:
>
>> 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. Thank you very much for your help!
>>
>
>
> Hi Renato,
>
> Nice that you got it working...
>
> Now, just as a heads up, that version of PyDev is quite old (the latest
> PyDev release: 3.3.3 is in many ways improved when comparing to older PyDev
> versions). I know Aptana Studio still has the older version, so, if you use
> mostly Python and you don't need the other features that Aptana Studio
> adds, it might be worth going to pure Eclipse + PyDev (or using LiClipse
> which also adds support for other languages -- besides being better
> configured out of the box, although it's a commercial counterpart of PyDev
> -- whose funds help to keep PyDev development going forward).
>
> Cheers,
>
> Fabio
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web