gcc: gcc version 4.9.2 (Debian 4.9.2-10)
cmake: 3.0.2
Error log:
[100%] Built target TMVAGui
[100%] Building CXX object tmva/pymva/CMakeFiles/PyMVA.dir/src/MethodPyAdaBoost.cxx.o
/home/exaos/Workspace/build/root/root6/tmva/pymva/src/MethodPyAdaBoost.cxx: In member function ‘virtual void TMVA::MethodPyAdaBoost::Init()’:
/home/exaos/Workspace/build/root/root6/tmva/pymva/src/MethodPyAdaBoost.cxx:178:60: error: ‘PyString_FromString’ was not declared in this scope
PyObject *pName = PyString_FromString("sklearn.ensemble");
^
/home/exaos/Workspace/build/root/root6/tmva/pymva/src/MethodPyAdaBoost.cxx: In member function ‘virtual void TMVA::MethodPyAdaBoost::Train()’:
/home/exaos/Workspace/build/root/root6/tmva/pymva/src/MethodPyAdaBoost.cxx:264:42: error: ‘PyString_AsString’ was not declared in this scope
PyData << PyString_AsString(model_data);
^
tmva/pymva/CMakeFiles/PyMVA.dir/build.make:92: recipe for target 'tmva/pymva/CMakeFiles/PyMVA.dir/src/MethodPyAdaBoost.cxx.o' failed
make[2]: *** [tmva/pymva/CMakeFiles/PyMVA.dir/src/MethodPyAdaBoost.cxx.o] Error 1
CMakeFiles/Makefile2:19437: recipe for target 'tmva/pymva/CMakeFiles/PyMVA.dir/all' failed
make[1]: *** [tmva/pymva/CMakeFiles/PyMVA.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
Both python2 and python3 are installed:
[ul]
[li] python-dev – 2.7.9-1[/li]
[li] python3-dev – 3.4.2[/li][/ul]
I’m not sure which is used during cmake and make.
During the cmake configuration is mention the version of Python found in the system. For example:
-- Looking for Python
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/bin/python (found version "2.7.9")
-- Found Python interpreter version 2.7
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.9")
[quote=“mato”]During the cmake configuration is mention the version of Python found in the system. For example:
[/quote]
Thanks. I think I know what the problem is. I checked the cmake log and found these outputs:
-- Found GSL: /usr/include (found suitable version "1.16", minimum required is "1.10")
-- Looking for Python
-- Found PythonInterp: /usr/bin/python (found version "2.7.9")
-- Found Python interpreter version 2.7
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found version "3.4.2")
-- Found NumPy: version "1.8.2" /usr/lib/python2.7/dist-packages/numpy/core/include
-- Looking for OpenGL
Then, make outputs:
[ 97%] [100%] Built target Eve
Built target TMVAGui
In file included from /usr/include/signal.h:342:0,
from /usr/include/python3.4m/pyfpe.h:129,
from /usr/include/python3.4m/Python.h:131,
from /srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx:19:
/srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx: In static member function ‘static void TMVA::PyMethodBase::PyInitialize()’:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1708:35: error: return-statement with a value, in function returning 'void' [-fpermissive]
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
^
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1713:151: note: in expansion of macro ‘NUMPY_IMPORT_ARRAY_RETVAL’
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
^
/srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx:91:7: note: in expansion of macro ‘import_array’
import_array();
^
/srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx:94:55: error: ‘PyString_FromString’ was not declared in this scope
PyObject *bName = PyString_FromString("__builtin__");
^
/srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx: In static member function ‘static void TMVA::PyMethodBase::PySetProgramName(TString)’:
/srv/repos/cern/root/tmva/pymva/src/PyMethodBase.cxx:136:53: error: cannot convert ‘char*’ to ‘wchar_t*’ for argument ‘1’ to ‘void Py_SetProgramName(wchar_t*)’
Py_SetProgramName(const_cast<char *>(name.Data()));
It seems that cmake found the python 2.7.9 headers but linked pymva with python 3.4.2. So odd!