ninia / jep

Embed Python in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import numpy exception in sharedInterpreter using jep

Dynasty-develop opened this issue · comments

Problem
1.jep.JepException: <class 'ImportError'>: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.
2.jep.JepException: <class 'ImportError'>: /usr/local/python3/lib/python3.10/lib-dynload/_posixsubprocess.cpython-310-x86_64-linux-gnu.so: undefined symbol: PyTuple_Type

Environment :

Centos 7
Python 3.10.14
Java Distribution and Version: jdk 8
Jep Version: jep-4.2.0
Python packages used : numpy, cv2, onnxruntime, torch, skimage

I suceed to install JEP/Java/python environment.
My project is working fine in my local Windows computer. When I deploy the project to Centos 7 and use jep to call python script, I am getting "Import Error". But I directly run the python script, its alse work abnormally. I am completely confused and dont know how to solve this trouble.

Troubleshooting:
sys.path from jep:
[/usr/local/python3/lib/python310.zip,
/usr/local/python3/lib/python3.10,
/usr/local/python3/lib/python3.10/lib-dynload,
/usr/local/python3/lib/python3.10/site-packages,
/home/xxx/xxx/xxx/xxx]

JEP:

(jep is installed under the site-packages)
Observations:
I can see the interpreters is initialized but when function call goes, I am getting the "Import Error"

Please help!
thank you!