Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

could not determine kind of name for C.PyImport_GetModule #19

Closed
AlbertBlanc opened this issue Apr 8, 2019 · 9 comments
Closed

could not determine kind of name for C.PyImport_GetModule #19

AlbertBlanc opened this issue Apr 8, 2019 · 9 comments

Comments

@AlbertBlanc
Copy link

AlbertBlanc commented Apr 8, 2019

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?

@GabrielDrapor
Copy link

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

@viney
Copy link

viney commented Sep 4, 2019

go get github.com/DataDog/go-python3
errors.go:74:14: could not determine kind of name for C.PyErr_SetImportErrorSubclass

@ayush--s
Copy link

ayush--s commented Sep 7, 2019

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

@luowencai
Copy link

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

@piccobit
Copy link

go get github.com/DataDog/go-python3
errors.go:74:14: could not determine kind of name for C.PyErr_SetImportErrorSubclass

  • 'PyErr_SetImportErrorSubclass' has been introduced in Python 3.6
  • 'PyImport_GetModule' has been introduced in Python 3.7

To me it looks like you have to update your Python version to v3.7 to get the support for both functions.

@hush-hush
Copy link
Member

hush-hush commented Nov 20, 2019

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.

@marcofiocco
Copy link

marcofiocco commented Nov 25, 2019

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

@marcofiocco
Copy link

If I compile with Python 3.8 I get could not determine kind of name for PyEval_ReInitThreads

@hush-hush
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants