ninia / jep

Embed Python in Java
Other
1.27k stars 146 forks source link

lib/python3.9/lib-dynload/resource.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type #494

Open BookaiJin opened 10 months ago

BookaiJin commented 10 months ago

Describe the bug lib/python3.9/lib-dynload/resource.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type

To Reproduce MEMORY_LIMIT_CODE = "import resource\n" + "\n" + "soft, hard = resource.getrlimit(resource.RLIMIT_AS)\n" + "resource.setrlimit(resource.RLIMIT_AS, (maxSize, hard))"; interceptor.set("maxSize", maxMemorySize); interceptor.exec(MEMORY_LIMIT_CODE);

Expected behavior limit python code memory usage

Environment (please complete the following information):

BookaiJin commented 10 months ago

I have ./configure --enbale-shared when install python

BookaiJin commented 10 months ago

if I don't use resource when I use pandas I got this error and then my java program crash

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.

Original error was: /opt/python/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyObject_SelfIter

pytz: /opt/python/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type

bsteffensmeier commented 10 months ago

An undefined symbol typically means that something went wrong loading libpython. The simplest workaround is to set the env var LD_PRELOAD to the location of the libpython which contains the missing symbol. On your system I think that would be '/usr/local/lib/libpython3.9.so'