There is an unexpected behavior of python in openSUSE (at least Leap 42.3 and Leap 15.1).
I am going to use a python module that needs to load external libraries (pyroot).
Normally, according to hints on the internet, a path to external libraries is set using LD_LIBRARY_PATH, but in openSUSE python does not try to look for libraries in the folders specified by LD_LIBRARY_PATH at all. I have tried the same for Ubuntu, and it worked as expected. Thus, I suppose it is a SUSE-related problem.
What should I do to fix this issue?
In my case the module and all related libraries are located in /usr/local/root/lib.
Here are some logs:
username@linux-jml8:~> python -c "import ROOT"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/root/lib/ROOT.py", line 24, in <module>
import cppyy
File "/usr/local/root/lib/cppyy.py", line 61, in <module>
import libPyROOT as _backend
ImportError: libMathCore.so: cannot open shared object file: No such file or directory
username@linux-jml8:~> ls /usr/local/root/lib/ROOT.py
/usr/local/root/lib/ROOT.py
username@linux-jml8:~> ls /usr/local/root/lib/libMathCore.so
/usr/local/root/lib/libMathCore.so
username@linux-jml8:~> echo $LD_LIBRARY_PATH
:/usr/local/root/lib
username@linux-jml8:~> echo $PYTHONPATH
/usr/local/root/lib
username@linux-jml8:~> strace python -c 'import ROOT' |& grep libMathCore.so
openat(AT_FDCWD, "/lib64/tls/haswell/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/tls/haswell/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/tls/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/tls/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/haswell/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/haswell/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/tls/haswell/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/tls/haswell/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/tls/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/tls/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/haswell/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/haswell/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/x86_64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/libMathCore.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
ImportError: libMathCore.so: cannot open shared object file: No such file or directory
As you can see, python does not try to check /usr/local/root/lib for the library, even though it is explicitly stated in LD_LIBRARY_PATH.