7

Here is my problem:

After I managed to install anaconda (having python 3.4), I apparently managed to install pybrain too. But when i use 'import pybrain' from anaconda or from the terminal too I get this error:

>>> import pybrain
Traceback (most recent call last):

File "<ipython-input-2-0fb7233d2a8c>", line 1, in <module>
import pybrain

 File "//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/pybrain/__init__.py", line 1, in <module>
from structure.__init__ import *

 ImportError: No module named 'structure'
Ben
  • 6,687
  • 2
  • 33
  • 46
nskywalker
  • 81
  • 1
  • 4
  • I think it begs asking, *how* did you install `pybrain`? Did you use `pip install pybrain` or `conda install pybrain`? I'm assuming it's in the correct location based on the traceback, but this might be a case of incomplete dependencies or somesuch. – WGS Oct 13 '14 at 16:04
  • Hi, actually I just followed what was explained in the site and then this procedure to get setuptools: https://pypi.python.org/pypi/setuptools – nskywalker Oct 13 '14 at 16:29
  • is there any way to recover or fix the dependencies? – nskywalker Oct 13 '14 at 16:31
  • I believe you're using a version of Pybrain that's not ported for Python 3. In particular, you need at least this commit: https://github.com/pybrain/pybrain/commit/dd66c7bccb4df0e0ae1432b97f80c7f23e812bb4. – Alok-- Oct 13 '14 at 16:42
  • Thank you very much. I downloaded the last version of pybrain so I thought it would work. Anyway, what should I do with what you posted exactly? (sorry for the lack of experience) – nskywalker Oct 13 '14 at 16:48
  • You could try by: 1) removing `//anaconda/lib/python3.4/site-packages/PyBrain-0.3-py3.4.egg/`. 2) Downloading and extracting from https://github.com/pybrain/pybrain/archive/master.zip, and then installing from that. – Alok-- Oct 13 '14 at 23:31
  • Thank you again. By 'installing' do you mean that I should substitute pybrain.egg with the other that I downloaded? – nskywalker Oct 14 '14 at 09:44
  • All right, I modified all the strings following these corrections (https://github.com/pybrain/pybrain/commit/dd66c7bccb4df0e0ae1432b97f80c7f23e812bb4) and it finally works!!! The only problem is that I have to use every time this command: 'export PYTHONPATH=$PYTHONPATH:'. Does anybody know how to launch pybrain directly from python without this command? – nskywalker Oct 14 '14 at 11:58
  • Ok, now I feel I'm very close. If I open pybrain from the terminal after having specified the PYTHONPATH it works. But when I open Python through anaconda in order to run what I write I get the message 'no module pybrai' as if anaconda couldn't see that pybrain is installed. Please help!!! – nskywalker Oct 14 '14 at 16:30
  • I meant that you download and extract the zip file, then `cd` to the new directory, and type `python setup.py install`. Before you do that though, you need to remove the old installed files (that was the first step in my instructions). – Alok-- Oct 15 '14 at 21:17

1 Answers1

8

Simply running sudo pip3 install git+https://github.com/pybrain/pybrain.git worked for me after having the same issue.

The version up on PyPi isn't Python 3 compatible. Installing the latest commit directly using pip3 should take care of your old package (from PyPi) as well.

erb
  • 14,503
  • 5
  • 30
  • 38