Closed suryaaaaa closed 7 years ago
@suryaaaaa, as I recall for me when I ran into this, look at the jep sh script for the ld_preload environment variable. Take a look at how the following file was setup in your environment and using the setup in it for your own jar executable.
/usr/bin/jep
Mine has the following for example that fixed it for me:
LD_LIBRARY_PATH="/usr/lib64:/usr/lib64/python3.6/site-packages/"; export LD_LIBRARY_PATH
LD_PRELOAD="/usr/lib64/libpython3.6m.so"; export LD_PRELOAD
i can able use normal python commands like
jep.eval("3+4");
but while using cpython extension library like
jep.eval("import pandas");
i have following error
jep.JepException: <class 'ImportError'>: Missing required dependencies ['numpy']
at /usr/local/lib/python3.4/dist-packages/pandas-0.19.1-py3.4-linux-x86_64.egg/pandas/init.
@tcederquist i have also tried using LD_LIBRARY PATH and LD_PRELOAD but same issue exists
@suryaaaaa , I had the same issue (worked on windows, not in linux). I'm using docker and I'm including the extracts of the image creation scripts to see if anything helps you. Make sure java_home is pointed at the correct location for both pip install and execution. Also make sure your entries match the jep shell script exactly. Here is what I installed:
yum install -y java-1.8.0-openjdk-devel
yum install -y https://centos7.iuscommunity.org/ius-release.rpm \
yum install -y python36u python36u-pip python36u-devel
And here is an extract of my install script (I had the same error as you did but all I have left are my docker install/start scripts and it works now, sorry my memory isn't better on what specifically fixed it)
export JAVA_HOME=/usr/lib/jvm/java \
&& pip3.6 install numpy \
&& pip3.6 install jep \
&& pip3.6 install pandas
And the startup script for the jar file that uses jep
export JAVA_HOME=/usr/lib/jvm/java
export LD_PRELOAD="/usr/lib64/libpython3.6m.so"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/python3.6/sitepackages/jep:/usr/lib64/python3.6/config:/usr/lib64/python3.6/lib-dynload
cd /usr/share/llf
java -Duser.dir=/usr/share/llf -jar ermasLogicRestService.jar $1 -Dorg.apache.commons.logging.diagnostics.dest=STDOUT
Thank you, @tcederquist, for assisting. I don't have any experience with pandas.
@suryaaaaa, there's no Linux setup instructions, it's generally just setup.py build install
. You should try running the jep command line interpreter which is very similar to the python command line interpreter. Just type jep
in a terminal if it's on your path. And then try import pandas
there and see if that works or if you get the same or a different error.
@ndjensen i have used jep from terminal it is working properly i can able to import pandas.But while opening it Eclipse i have problem
@tcederquist i have tried all the things but still issue exists
if i import numpy in jep console it is working properly but in eclipse it throws following
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf
(removes all
files not under version control). Otherwise reinstall numpy.
Original error was: /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/core/multiarray.cpython-34m.so: undefined symbol: PyExc_SystemError
at /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/core/__init__.<module>(__init__.py:26)
at /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/lib/type_check.<module>(type_check.py:11)
at /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/lib/__init__.<module>(__init__.py:8)
at /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/add_newdocs.<module>(add_newdocs.py:13)
at /usr/local/lib/python3.4/dist-packages/numpy-1.13.0-py3.4-linux-x86_64.egg/numpy/__init__.<module>(__init__.py:142)
@suryaaaaa,The fact that it works from JEP means its ready to run and that is great new. I suspect the environment variables for preload and ld are not correct at the point of execution in the target jvm. Don't mix jvm's either. Are you using eclipse in linux or running jep in a jar of your design? You may need to make sure all the environments are setup correctly for the jvm of your project and the project is using the same jvm as you compiled into jep when you installed it. Try echoing out the environment from the java main to verify you have ld_preload and ld_library_path and they point to the same as the jep script. The jep script is your reference, what's in there should be represented in your jvm environment.
@suryaaaaa, if you're running your application from Eclipse, go to menu Run -> Run Configurations..., select your application, go to Environment tab, add LD_PRELOAD and set it to the libpython.so file, add LD_LIBRARY_PATH as the path to the lib directory of the Python you're using.
For example (I'm guessing at your paths):
LD_PRELOAD=/usr/local/lib/python3.4/lib/libpython3.4m.so
LD_LIBRARY_PATH=/usr/local/lib/python3.4/lib:$LD_LIBRARY_PATH
You want LD_PRELOAD set to the .so file and LD_LIBRARY_PATH set to the python lib directory. For the paths follow the example in the jep command line script as @tcederquist suggests.
@tcederquist @ndjensen it works perfectly thanks for helping me
hi i am newbie to jep when i installed jep on windows it works perfectly but while working in linux i can able to get output of addition but while adding cpython extension library there is a error like <class 'ImportError'>: Missing required dependencies ['numpy'].can anyone help me and also i need a installation guide of jep in linux.Thanks in advance