Reputation: 11
I have tried installing FANN Python bindings on Ubuntu using all of apt-get install, pip, and directly from source, but the same error keeps occurring when I try to import FANN. Namely, it tells me that fann_copy is undefined (the following is the specific error):
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fann2 import libfann
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/fann2-1.0.7-py2.7-linux-x86_64.egg/fann2/__init__.py", line 4, in <module>
from fann2 import libfann
File "/usr/local/lib/python2.7/dist-packages/fann2-1.0.7-py2.7-linux-x86_64.egg/fann2/libfann.py", line 28, in <module>
_libfann = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/fann2-1.0.7-py2.7-linux-x86_64.egg/fann2/libfann.py", line 24, in swig_import_helper
_mod = imp.load_module('_libfann', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/fann2-1.0.7-py2.7-linux-x86_64.egg/fann2/_libfann.so: undefined symbol: fann_copy
Any suggestions would be appreciated.
Upvotes: 0
Views: 812
Reputation: 41
I had the same problem than you, and resolved it this way.
I basically followed the installation process of FANN that you can found here, and did the following :
wget http://downloads.sourceforge.net/project/fann/fann/2.2.0/FANN-2.2.0-Source.zip
unzip FANN-2.2.0-Source.zip
cd FANN-2.2.0-Source/
cmake .
sudo make install
Te be sure that FANN is well installed :
cd examples/
make runtest
Then, install swig:
sudo aptitude install swig
(I had swig2.0, swig3.0 and installed just swig after, I don't think it helps since FANN seems to look for swig2.0 binary, but who knows ?)
Then install python bindings :
sudo aptitude install pip
sudo pip install fann2
Now, it should be fine.
I think I had the same error because i used an old version of FANN (I blindly followed this tutorial).
Hope this helped.
Upvotes: 4