ktnumpy native lib can't be found
alannnna opened this issue · 3 comments
On version 0.1.2 on Mac I'm getting the following error:
java.lang.UnsatisfiedLinkError: no ktnumpy in java.library.path
/private/var/folders/x9/sm6f5rgx4y9cqlcv6wxttvzjn76hsr/T/nativeKtNumPy14035014827586128545/libktnumpy.dylib: dlopen(/private/var/folders/x9/sm6f5rgx4y9cqlcv6wxttvzjn76hsr/T/nativeKtNumPy14035014827586128545/libktnumpy.dylib, 1): Library not loaded: @rpath/libpython3.7m.dylib
Referenced from: /private/var/folders/x9/sm6f5rgx4y9cqlcv6wxttvzjn76hsr/T/nativeKtNumPy14035014827586128545/libktnumpy.dylib
Reason: image not found
at org.jetbrains.numkt.LibraryLoader.loadLibraries(NativeLibUtils.kt:89)
at org.jetbrains.numkt.Interpreter.initialize(Interpreter.kt:49)
at org.jetbrains.numkt.Interpreter.access$initialize(Interpreter.kt:24)
at org.jetbrains.numkt.Interpreter$Companion.getInterpreter(Interpreter.kt:31)
at org.jetbrains.numkt.UtilsKt.callFunc(Utils.kt:38)
at org.jetbrains.numkt.UtilsKt.callFunc$default(Utils.kt:36)
at numkt2.AppTest.runNumpyStuff(AppTest.kt:47)
I am getting a similar error (with a non-tmp path) when I clone the repo and try running the tests. In both cases, the directory exists but there's no ktnumpy shared library inside.
This error is because the linker can't build python library and our library.
Please write what value returns sysconfig.get_config_var('LDVERSION')
$ python
Python 3.7.2 (default, Feb 12 2019, 08:15:36)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils import sysconfig
>>> sysconfig.get_config_var('LDVERSION')
'3.7m'
The problem is that standard python library (not from anaconda) has an absolute path in install_name. You can verify this by calling
otool -D /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib
Our library is linked to python from anaconda and there is a relative path:
libktnumpy.dylib
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
@rpath/libpython3.7m.dylib (compatibility version 3.7.0, current version 3.7.0)
@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
Unfortunately, the only workaround is to use python3.7 from anaconda.
It will take some time to fix this bug.