[SOLVED] Error importing Python's PyBrain library in Eclipse when using "from x import y" [message #1244726] |
Wed, 12 February 2014 20:06 |
Renato V Messages: 8 Registered: February 2014 |
Junior Member |
|
|
I'm using Python 2.7.5 and Eclipse 4.3.1 in OpenSUSE 13.1. I installed all my Python Libraries (ex: matplotlib, numpy, scipy etc) from OpenSUSE official repositories, except PyBrain 0.3, which I installed via PIP. Within Eclipse, specifically with PyBrain library (which, again, I installed via PIP) I can import it olny using the import format. If I try to import something from PyBrain library using from / import format, I receive an ImportError. This problem happens only with PyBrain library, which I installed via PIP, and only inside Eclipse (in Python's Shell both import formats work with PyBrain). All other libraries can import modules either using import command or from / import format inside and outside Eclipse. Here are some examples of import command and from / import command that work within Eclipse:
import matplotlib
from matplotlib import pylab
import pybrain
But I can't import nothing from PyBrain using the from / import format. The followin code:
from pybrain.supervised.trainers import BackpropTrainer
returns:
Traceback (most recent call last):
File "/media/arquivos/pybrain_import_test.py", line 9, in <module>
from pybrain.supervised.trainers import BackpropTrainer
ImportError: No module named supervised.trainers
Another example when trying to import a feature from PyBrain library using from / import format :
from pybrain.datasets import SupervisedDataSet
returns:
Traceback (most recent call last):
File "/media/arquivos/pybrain_import_test2.py", line 7, in <module>
from pybrain.datasets import SupervisedDataSet
ImportError: No module named datasets
And another one:
from pybrain import Network
returns:
Traceback (most recent call last):
File "/media/arquivos/pybrain_import_test3.py", line 8, in <module>
from pybrain import Network
ImportError: cannot import name Network
It's strange because this error with from / import command when importing Pybrain library occurs only from within Eclipse. f I use Python shell (or IPython), the above imports work:
$ python
Python 2.7.5 (default, May 30 2013, 16:55:57) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybrain
>>> from pybrain.supervised.trainers import BackpropTrainer
>>> from pybrain.datasets import SupervisedDataSet
>>> from pybrain import Network
>>>
So I guess the problems is related to some Eclipse setting, maybe related to some PATH. Could someone help me, please?
[Updated on: Tue, 18 February 2014 11:17] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06106 seconds