Closed AlbertBlanc closed 4 years ago
I use 'go get' and meet the same problem too.
root@17c119383d9b:~# go get github.com/DataDog/go-python3
go: finding github.com/DataDog/go-python3 latest
# github.com/DataDog/go-python3
go/pkg/mod/github.com/!data!dog/go-python3@v0.0.0-20190130222855-0b25cc550560/import.go:125:14: could not determine kind of name for C.PyImport_GetModule
go get github.com/DataDog/go-python3 errors.go:74:14: could not determine kind of name for C.PyErr_SetImportErrorSubclass
get get succeeded without errors. this happened on build though:
> go build
# github.com/DataDog/go-python3
../../github.com/DataDog/go-python3/import.go:125:14: could not determine kind of name for C.PyImport_GetModule
the same,while use glide get the package,and run some test demo
vendor/github.com/DataDog/go-python3/import.go:125:14: could not determine kind of name for C.PyImport_GetModule
go get github.com/DataDog/go-python3 errors.go:74:14: could not determine kind of name for C.PyErr_SetImportErrorSubclass
To me it looks like you have to update your Python version to v3.7 to get the support for both functions.
Hi,
You will need the dev package for Python3 install that provide the Python.h header which define this all Python function. make sure it's in your resolution path for the compiler too.
Also @piccobit is right, this package is meant for python 3.7.
I get lots of errors like:
> go get github.com/DataDog/go-python3
# github.com/DataDog/go-python3
/usr/local/lib/libpython3.7m.a(complexobject.o): In function `_Py_c_abs':
/opt/Python-3.7.4/Objects/complexobject.c:203: undefined reference to `hypot'
/usr/local/lib/libpython3.7m.a(complexobject.o): In function `_Py_c_pow':
/opt/Python-3.7.4/Objects/complexobject.c:132: undefined reference to `hypot'
/opt/Python-3.7.4/Objects/complexobject.c:133: undefined reference to `pow'
/opt/Python-3.7.4/Objects/complexobject.c:134: undefined reference to `atan2'
/opt/Python-3.7.4/Objects/complexobject.c:136: undefined reference to `sincos'
/opt/Python-3.7.4/Objects/complexobject.c:137: undefined reference to `exp'
/opt/Python-3.7.4/Objects/complexobject.c:138: undefined reference to `log'
/opt/Python-3.7.4/Objects/complexobject.c:132: undefined reference to `hypot'
/opt/Python-3.7.4/Objects/complexobject.c:133: undefined reference to `pow'
/opt/Python-3.7.4/Objects/complexobject.c:134: undefined reference to `atan2'
/opt/Python-3.7.4/Objects/complexobject.c:135: undefined reference to `sincos'
/opt/Python-3.7.4/Objects/complexobject.c:132: undefined reference to `hypot'
/opt/Python-3.7.4/Objects/complexobject.c:133: undefined reference to `pow'
/opt/Python-3.7.4/Objects/complexobject.c:134: undefined reference to `atan2'
/opt/Python-3.7.4/Objects/complexobject.c:136: undefined reference to `sincos'
/opt/Python-3.7.4/Objects/complexobject.c:137: undefined reference to `exp'
/opt/Python-3.7.4/Objects/complexobject.c:138: undefined reference to `log'
/usr/local/lib/libpython3.7m.a(complexobject.o): In function `_Py_c_abs':
/opt/Python-3.7.4/Objects/complexobject.c:203: undefined reference to `hypot'
/usr/local/lib/libpython3.7m.a(floatobject.o): In function `float_divmod':
/opt/Python-3.7.4/Objects/floatobject.c:629: undefined reference to `fmod'
/usr/local/lib/libpython3.7m.a(floatobject.o): In function `float_rem':
/opt/Python-3.7.4/Objects/floatobject.c:600: undefined reference to `fmod'
/usr/local/lib/libpython3.7m.a(floatobject.o): In function `float_divmod':
/opt/Python-3.7.4/Objects/floatobject.c:629: undefined reference to `fmod'
/usr/local/lib/libpython3.7m.a(floatobject.o): In function `float___round___impl':
/opt/Python-3.7.4/Objects/floatobject.c:1055: undefined reference to `round'
/opt/Python-3.7.4/Objects/floatobject.c:1058: undefined reference to `round'
/usr/local/lib/libpython3.7m.a(floatobject.o): In function `float_pow':
/opt/Python-3.7.4/Objects/floatobject.c:738: undefined reference to `fmod'
/opt/Python-3.7.4/Objects/floatobject.c:728: undefined reference to `fmod'
/opt/Python-3.7.4/Objects/floatobject.c:788: undefined reference to `pow'
/opt/Python-3.7.4/Objects/floatobject.c:764: undefined reference to `fmod'
/usr/local/lib/libpython3.7m.a(longobject.o): In function `PyLong_FromString':
/opt/Python-3.7.4/Objects/longobject.c:2287: undefined reference to `log'
/usr/local/lib/libpython3.7m.a(pytime.o): In function `_PyTime_RoundHalfEven':
/opt/Python-3.7.4/Python/pytime.c:100: undefined reference to `round'
/opt/Python-3.7.4/Python/pytime.c:103: undefined reference to `round'
/opt/Python-3.7.4/Python/pytime.c:100: undefined reference to `round'
/opt/Python-3.7.4/Python/pytime.c:103: undefined reference to `round'
/opt/Python-3.7.4/Python/pytime.c:100: undefined reference to `round'
/usr/local/lib/libpython3.7m.a(pytime.o):/opt/Python-3.7.4/Python/pytime.c:103: more undefined references to `round' follow
/usr/local/lib/libpython3.7m.a(dynload_shlib.o): In function `_PyImport_FindSharedFuncptr':
/opt/Python-3.7.4/./Python/dynload_shlib.c:83: undefined reference to `dlsym'
/opt/Python-3.7.4/./Python/dynload_shlib.c:96: undefined reference to `dlopen'
/opt/Python-3.7.4/./Python/dynload_shlib.c:127: undefined reference to `dlsym'
/opt/Python-3.7.4/./Python/dynload_shlib.c:96: undefined reference to `dlopen'
/opt/Python-3.7.4/./Python/dynload_shlib.c:102: undefined reference to `dlerror'
/usr/local/lib/libpython3.7m.a(posixmodule.o): In function `os_openpty_impl':
/opt/Python-3.7.4/./Modules/posixmodule.c:5951: undefined reference to `openpty'
/usr/local/lib/libpython3.7m.a(posixmodule.o): In function `os_forkpty_impl':
/opt/Python-3.7.4/./Modules/posixmodule.c:6045: undefined reference to `forkpty'
collect2: error: ld returned 1 exit status
I fixed it by adding:
Libs: -L${libdir} -lpython3.7m -lutil -lm -ldl
to python3.pc
If I compile with Python 3.8 I get could not determine kind of name for PyEval_ReInitThreads
Hi @marcofiocco, the lib only support python 3.7 currently. PyEval_ReInitThreads
was removed in 3.8. I fixed the README to make this clear (thanks for raising the issue).
We do not plan on updating this to work with both 3.7 and 3.8 but if you would like to open a PR for this I'll be happy to review it.
I also updated the README to better explain that the python headers are needed to compile this package. Default workflow looks like this (on Debian for example):
$> apt-get install python3.7-dev
$> go get github.com/DataDog/go-python3
Closing this issue, but feel free to reopen it or open another issue if needed.
Describe what happened: when the package installed with go install : go install github.com/DataDog/go-python3 "gowork/src/github.com/DataDog/go-python3/import.go:125:14: could not determine kind of name for C.PyImport_GetModule"
why it happens? Did i miss anything?