Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About LD_LIBRARY_PATH and LD_PRELOAD #534

Open
qmj123 opened this issue May 27, 2024 · 3 comments
Open

About LD_LIBRARY_PATH and LD_PRELOAD #534

qmj123 opened this issue May 27, 2024 · 3 comments

Comments

@qmj123
Copy link

qmj123 commented May 27, 2024

Describe the problem
How to solve the following problems without setting the LD_PRELOAD parameter and How to set environment variables in Java's Jep.
jep.JepException: <class 'ImportError'>: /xxx/python/lib/python3.10/lib-dynload/_posixsubprocess.cpython-310-x86_64-linux-gnu.so: undefined symbol: PyTuple_Type

Environment (please complete the following information):

  • OS Platform, Distribution, and Version:
  • Python Distribution and Version: 3.10
  • Java Distribution and Version: jdk11
  • Jep Version:4.1.1
  • Python packages used (e.g. numpy, pandas, tensorflow):numpy
@Dynasty-develop
Copy link

I have same problem. I can`t solve this for a week.

@Dufgui
Copy link

Dufgui commented Jun 20, 2024

me too

@bsteffensmeier
Copy link
Member

In some cases this can be solved by setting PYTHONHOME or using PyConfig.setPythonHome(). In some cases LD_PRELOAD may be required when other native python libraries depend on libpython but do not declare that dependency as part of their library. This is unfortunately a common way of building native python extensions so they can be used with a statically linked python executable. There is nothing jep can do to solve this since it is a problem with libraries that are not part of jep.

For example in the case of _posixsubprocess.cpython-310-x86_64-linux-gnu.so, it is looking for a symbol that is defined in libpython. If _posixsubprocess.cpython-310-x86_64-linux-gnu.so declares a dependency on libpython then the symbol would be available to it. Since the symbol is not available I can only assume it did not declare a dependency. You can check the dependencies on linux by running ldd /xxx/python/lib/python3.10/lib-dynload/_posixsubprocess.cpython-310-x86_64-linux-gnu.so The correct solution is for _posixsubprocess.cpython-310-x86_64-linux-gnu.so to declare a dependency on libpython.

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

No branches or pull requests

4 participants