alibaba / alibaba/x-deeplearning

python3环境下编译错误

Open
#314 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PureBasic
Stars
4.3k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

```
In file included from /opt/rh/devtoolset-4/root/usr/include/c++/5.3.1/cstddef:45:0,
from /usr/local/app/x-deeplearning/xdl/third_party/tbb/include/tbb/tbb_config.h:40,
from /usr/local/app/x-deeplearning/xdl/third_party/tbb/include/tbb/tbb_stddef.h:95,
from /usr/local/app/x-deeplearning/xdl/third_party/tbb/include/tbb/task.h:24,
from /usr/local/app/x-deeplearning/xdl/third_party/tbb/include/tbb/parallel_for.h:25,
from /usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/common/tensor.h:22,
from /usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.h:24,
from /usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc:16:
/usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc: In constructor ‘ps::{anonymous}::PythonContext::PythonContext()’:
/usr/local/app/anaconda3/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h:1542:35: error: returning a value from a constructor
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
^
/usr/local/app/anaconda3/lib/python3.6/site-packages/numpy/core/include/numpy/__multiarray_api.h:1547: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; } }
^
/usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc:55:7: note: in expansion of macro ‘import_array’
import_array();
^
/usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc: In member function ‘std::string ps::{anonymous}::PythonContext::getException()’:
/usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc:80:49: error: ‘PyString_FromString’ was not declared in this scope
PyObject* slash_n = PyString_FromString("\n");
^
/usr/local/app/x-deeplearning/xdl/ps-plus/ps-plus/server/udf/python_runner.cc:82:52: error: ‘PyString_AsString’ was not declared in this scope
char *pStrErrorMessage = PyString_AsString(pstr);

```
参考这个https://github.com/numpy/numpy/issues/10035 ,
好像代码用的是python2,不支持python3?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in ps-plus/ps-plus/server/udf/python_runner.cc, especially the PythonContext constructor and getException(), and reproduce the build with Python 3 and the installed NumPy headers. Check the NumPy import_array() and PyString errors, then verify that the project compiles successfully under Python 3 with exception reporting still working.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.