problem z instalacją fann2 dla pythona

  • 1 replies
  • 1425 views
*

marcin009988

problem z instalacją fann2 dla pythona
« dnia: Czerwiec 02, 2015, 02:05:47 am »
Witam

jak w temacie, nie mogę zainstalować fann2 dla pythona, najpierw nie było swig ale doinstalowałem ale teraz sypie błędami przy kompilacji
marcin@r780_mint ~ $ sudo su
[sudo] password for marcin:
r780_mint marcin # pip install fann2
Downloading/unpacking fann2
  Downloading fann2-1.0.7.tar.gz (63kB): 63kB downloaded
  Running setup.py (path:/tmp/pip-build-luGOMZ/fann2/setup.py) egg_info for package fann2
   
Installing collected packages: fann2
  Running setup.py install for fann2
   
    building 'fann2._libfann' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DSWIG_COMPILE -I./include -I../include -Iinclude -I/usr/include/python2.7 -c fann2/fann2_wrap.cxx -o build/temp.linux-x86_64-2.7/fann2/fann2_wrap.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data(PyObject*, PyObject*)’:
    fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                                   ^
    fann2/fann2_wrap.cxx:9252:13: note: ‘argv[0]’ was declared here
       PyObject *argv[2];
                 ^
    fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data_parent(PyObject*, PyObject*)’:
    fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                                   ^
    fann2/fann2_wrap.cxx:4594:13: note: ‘argv[0]’ was declared here
       PyObject *argv[2];
                 ^
    fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_neural_net_parent(PyObject*, PyObject*)’:
    fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                                   ^
    fann2/fann2_wrap.cxx:5299:13: note: ‘argv[0]’ was declared here
       PyObject *argv[2];
                 ^
    c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/fann2/fann2_wrap.o -ldoublefann -o build/lib.linux-x86_64-2.7/fann2/_libfann.so
    /usr/bin/ld: cannot find -ldoublefann
    collect2: error: ld returned 1 exit status
    error: command 'c++' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-luGOMZ/fann2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PvNxxh-record/install-record.txt --single-version-externally-managed --compile:
    running swig

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/fann2

copying fann2/__init__.py -> build/lib.linux-x86_64-2.7/fann2

copying fann2/libfann.py -> build/lib.linux-x86_64-2.7/fann2

running egg_info

writing fann2.egg-info/PKG-INFO

writing top-level names to fann2.egg-info/top_level.txt

writing dependency_links to fann2.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found



reading manifest file 'fann2.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

writing manifest file 'fann2.egg-info/SOURCES.txt'

copying fann2/fann2.i -> build/lib.linux-x86_64-2.7/fann2

copying fann2/fann2_wrap.cxx -> build/lib.linux-x86_64-2.7/fann2

copying fann2/fann_cpp_subclass.h -> build/lib.linux-x86_64-2.7/fann2

running build_ext

building 'fann2._libfann' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/fann2

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DSWIG_COMPILE -I./include -I../include -Iinclude -I/usr/include/python2.7 -c fann2/fann2_wrap.cxx -o build/temp.linux-x86_64-2.7/fann2/fann2_wrap.o

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data(PyObject*, PyObject*)’:

fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]

 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)

                                                                                                               ^

fann2/fann2_wrap.cxx:9252:13: note: ‘argv[0]’ was declared here

   PyObject *argv[2];

             ^

fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data_parent(PyObject*, PyObject*)’:

fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]

 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)

                                                                                                               ^

fann2/fann2_wrap.cxx:4594:13: note: ‘argv[0]’ was declared here

   PyObject *argv[2];

             ^

fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_neural_net_parent(PyObject*, PyObject*)’:

fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]

 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)

                                                                                                               ^

fann2/fann2_wrap.cxx:5299:13: note: ‘argv[0]’ was declared here

   PyObject *argv[2];

             ^

c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/fann2/fann2_wrap.o -ldoublefann -o build/lib.linux-x86_64-2.7/fann2/_libfann.so

/usr/bin/ld: cannot find -ldoublefann

collect2: error: ld returned 1 exit status

error: command 'c++' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-luGOMZ/fann2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PvNxxh-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-luGOMZ/fann2
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 248, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
r780_mint marcin # easy_install fann2
Searching for fann2
Reading https://pypi.python.org/simple/fann2/
Best match: fann2 1.0.7
Downloading https://pypi.python.org/packages/source/f/fann2/fann2-1.0.7.tar.gz#md5=9ea834fba950ab0f6113822bb168330f
Processing fann2-1.0.7.tar.gz
Writing /tmp/easy_install-FmHYhX/fann2-1.0.7/setup.cfg
Running fann2-1.0.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-FmHYhX/fann2-1.0.7/egg-dist-tmp-M0FqYS
running swig
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data(PyObject*, PyObject*)’:
fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                               ^
fann2/fann2_wrap.cxx:9252:13: note: ‘argv[0]’ was declared here
   PyObject *argv[2];
             ^
fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_training_data_parent(PyObject*, PyObject*)’:
fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                               ^
fann2/fann2_wrap.cxx:4594:13: note: ‘argv[0]’ was declared here
   PyObject *argv[2];
             ^
fann2/fann2_wrap.cxx: In function ‘PyObject* _wrap_new_neural_net_parent(PyObject*, PyObject*)’:
fann2/fann2_wrap.cxx:1164:111: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
                                                                                                               ^
fann2/fann2_wrap.cxx:5299:13: note: ‘argv[0]’ was declared here
   PyObject *argv[2];
             ^
/usr/bin/ld: cannot find -ldoublefann
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'c++' failed with exit status 1

z managera pakietów i managera oprogramowania te blioteki się instalują ale nie mogę ich użyć w ipythonie i innych interpreterach, po prostu nie widzi tych bibliotek

System x64 LMDE 2

*

marcin009988

Odp: problem z instalacją fann2 dla pythona
« Odpowiedź #1 dnia: Czerwiec 02, 2015, 15:44:44 pm »
znalazłem rozwiązanie problemu
 http://stackoverflow.com/questions/16198113/fann-python-bindings-failing

w skrócie to wystarczy po zainstalowaniu z managera pakietów:
- libfann
- python-pyfann
(ja instalowałem w tej kolejności)
znaleźć ścieżkę do folderu pyfann (u mnie /usr/lib/python2.7/dist-packages/pyfann) i w pliku __init__.py zmienić zawartość (trzeba zmienić uprawnienia) na :
#
# Fast Artificial Neural Network library for Python
#

# import imp so we can load modules ourselves rather than through import magic
import imp

# try to load libfann, giving the exact path of where libfann resides
imp.load_source ('libfann','*ścieżka*/libfann.py')

i można importować