tburmeister/pyneural

import error

Closed this issue · 8 comments

Hi there, great work on this. When i try to compile it under linux 64 bit though i get

neural.c: In function ‘neural_sgd_back_prop’:
neural.c:141:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   for (int j = 0; j < cols; j++) {

i tried setting the -std=c++0x flag but to no avail, probably because it's C not C++. Could you look into this? Thanks!

Actually scratch that. I just was unfamiliar with plain C compilation flags.
Using:

CFLAGS="-I/path/to/cblas/include -L/path/to/cblas/lib -lcblas -std=c11" python setup.py build_ext

works just fine.
However, when trying to import it i get:

ImportError: ./pyneural.so: undefined symbol: cblas_saxpy

Hi techfort,

Have you installed cblas? If so, the include and library directories (-I and -L) in my example are just placeholders - you need to fill in the actual paths to the cblas include and library directories. cblas_saxpy is part of the cblas library, so I think that error indicates that cblas is not being found.

-Taylor

hey Taylor
cblas is installed and i'm using real paths not placeholders.
I know because before installing cblas it wouldn't even compile.
The whole installation seems to have gone well, but when importing the package into python i'm getting the above error.

Hmm, interesting... Probably won't have time to look into this until this evening, but what version of Linux are you using?

Kubuntu 14.04 64-bit. No rush.

Hey, finally got around to digging into this. I ran into the same issue trying to install on Ubuntu; apparently it's pretty finicky about compiler flags. I managed to get the library to compile after editing the setup.py, which had the added bonus of making things a little cleaner. Try doing a git pull and then running just:
python setup.py build_ext
sudo python setup.py install
You may need to change the include_dirs and library_dirs in setup.py first, depending on where you installed OpenBLAS.

Hi Taylor,
thanks for that, I'll be trying this out tomorrow and let you know.

Hey, you can close this, it's working perfectly. Note that the LD_LIBRARY_PATH step was necessary, without it python would break complaining libopenblas.so.0 was not found. Thanks!