Monday, May 28, 2012

Python SVM on OSX 10.6.8

So I finally got some Python SVM love on OSX 10.6.8 by using the Python bindings for libsvm.  However that was after having spent half a day trying to build PyML and Scikit.  I had thought these "pure" python projects would be the simpler route to take.  I got stuck for a bit installing numpy and other supporting packages, but even having got these working I couldn't get PyML or Scikit to build.  The problem was errors like this:

compiling C++ sources
C compiler: c++ -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3

compile options: '-I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -c'
c++: sklearn/svm/src/libsvm/libsvm_template.cpp
llvm-g++-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccpSkuud.out
llvm-g++-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin10-llvm-g++-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccpSkuud.out
error: Command "c++ -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -c sklearn/svm/src/libsvm/libsvm_template.cpp -o build/temp.macosx-10.3-fat-2.7/sklearn/svm/src/libsvm/libsvm_template.o" failed with exit status 255

and

building 'PyML/containers/ext/_csparsedataset' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c PyML/containers/ext/SparseDataSet_wrap.cpp -o build/temp.macosx-10.3-fat-2.7/PyML/containers/ext/SparseDataSet_wrap.o
In file included from /usr/include/architecture/i386/math.h:626,
                 from /usr/include/math.h:28,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
                 from PyML/containers/ext/SparseDataSet_wrap.cpp:149:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/as/x86_64/as for architecture x86_64
/usr/bin/../libexec/as/i386/as for architecture i386
/usr/bin/../libexec/as/arm/as for architecture arm
lipo: can't open input file: /var/tmp//ccyq6iNy.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1


I did all the usual searches and played around with gcc settings and so forth, but generally to no joy.  I guess I should have posted the above with details to the relevant mailing lists, but having got libsvm to work I just focused on that.  I'll come back to this if libsvm hosting becomes an issue for an online deployment ...

No comments: