lib/python3.9/lib-dynload/resource.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type
BookaiJin opened this issue · comments
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):
- OS Platform, Distribution, and Version: RedHat 7.9
- Python Distribution and Version: python3.9.12
- Java Distribution and Version: 1.8.151
- Jep Version: 4.1.1
- Python packages used (e.g. numpy, pandas, tensorflow): resource
I have ./configure --enbale-shared when install python
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:
- The Python version is: Python3.9 from "/usr/local/bin/python3"
- The NumPy version is: "1.25.2"
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
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'