No module named 'structure' when installing PyBrain even though it's in the folder
Asked Answered
B

5

6

I installed PyBrain via PyCharm and when I try to compile I get the following error:

Traceback (most recent call last):
  File "C:/Users/Marcus/PycharmProjects/ANN/ann.py", line 2, in <module>
    from pybrain.tools.shortcuts import buildNetwork
  File "C:\Python34\lib\site-packages\pybrain\__init__.py", line 1, in <module>
    from structure.__init__ import *
ImportError: No module named 'structure'

However, in the folder site-packages\pybrain\ there's a folder named 'structure' with (what I assume is) what pybrain is asking for.

enter image description here

I'm pretty new to Python so I'm not completely used to this installing packages thing. Is it something that I missed? I have tried to search for a package named "structure" in the PyCharm package installer but there is none (only a 'structures').

Thanks in advance

EDIT: A comment asked me to further explain how I installed the package. In PyCharm, I went to project settings -> project interpreter -> search for "pybrain"

enter image description here

Bullheaded answered 6/3, 2015 at 9:58 Comment(3)
Please show exactly what you did to install that module. Note that the code for the module on Github shows from pybrain.structure.__init__, not from structure..., so something is weird.Messer
It's also worth noting that the Pybrain code here is very weird anyway and shows quite a large misunderstanding of Python modules: you don't import from __init__, you import from the package itself. No idea why they've done that, although it does seem to be consistent throughout the project.Messer
Thank you. I added a screenshot of how I installed this module. You seem to be onto something as the problem disappeared when I wrote pybrain.strucutre.__init__, however, this introduced similar errors in other files so I guess it's a problem with this installationBullheaded
K
6

I was having the same problem and tried all the suggestions mentioned here. Finally I realized that the version that was installing was 0.3.1, and it is not compatible with Python 3. So I deleted that version and then ran !pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip(from Spyder ipython console). This finally worked.

Keelung answered 5/12, 2016 at 19:2 Comment(0)
M
3

I encountered the same problem. I am working on Windows 8, 64 bit machine, with WinPython.

As every newbie would do. I install pip and then installed pybrain (or PyBrain, doesn't make difference).

After I tried to see if its working like this :

 import pybrain

I got an error saying :

There is no module named "Structures".

When I checked the site-packages, it was there.

I tried the following approaches :

  1. I tried reinstalling Structures.
  2. I tried using pip3 instead of pip.
  3. I tried pip3 install pybrain --upgrade
  4. I downloaded the .zip file of the entire project from github here and after unzipping it, went inside it from cmd and did python setup.py install.

The 4th approach worked like a charm.

Cheers.

Meuse answered 29/10, 2015 at 16:31 Comment(3)
@Rishika What is the problem you faced?Meuse
#34493717 ... Solves this problem by git installing pybrain...Selia
This worked for me: pip3 install https://github.com/pybrain/pybrain/archive/0.3.3.zip In my case was pip3, but if could be pipIsosteric
J
2

What I have done as following and it works. (windows 7, anaconda3 installed)

  1. Download ZIP file from https://github.com/pybrain/pybrain
  2. Extract the zip file and try python setup.py install
  3. Open anaconda command and run conda update conda
Joker answered 18/12, 2015 at 11:7 Comment(0)
I
2

This worked for me: pip3 install https://github.com/pybrain/pybrain/archive/0.3.3.zip In my case was pip3, but it could be pip

Isosteric answered 18/6, 2017 at 20:54 Comment(0)
G
1

I would use pip (installed with 3.4) to install packages for 3.4+. I used pip install pybrain (or maybe ... PyBrain) last summer (for someone else) and the install worked with no problem.

What is a problem is that PyBrain is a 2.x package. Fortunately, most of the incompatibilities are in the test suite (and those mostly due to using doctests). The user I installed it for ran into a few easily fixed syntax errors and is still using PyBrain for a research project.

Gomel answered 6/3, 2015 at 20:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.