7. Troubleshooting#
7.1. Cannot load libomp
#
Upon importing detkit, you may encounter this error:
ImportError: dlopen(.../site-packages/detkit/_functions/logdet.cpython-311-darwin.so, 2):
Library not loaded: @loader_path/../.dylibs/libomp.dylib
Referenced from: .../site-packages/imate/_functions/logdet.cpython-311-darwin.so
Reason: no suitable image found. Did find:
.../site-packages/detkit/_functions/logdet/../.dylibs/libomp.dylib:
cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
This message indicates that OpenMP is not installed on your system, a requirement for the detkit. To resolve this issue, refer to OpenMP installation instructions.
7.2. Issue of Initializing libomp
#
When using any of the detkit functions, specifically with the method=slq
option, you may encounter the following error:
OMP: Error #15: Initializing libomp.dylib, but found libiomp5.dylib already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into
the program. That is dangerous, since it can degrade performance or cause incorrect
results. The best thing to do is to ensure that only a single OpenMP runtime is linked
into the process, e.g. by avoiding static linking of the OpenMP runtime in any library.
As an unsafe, unsupported, undocumented workaround you can set the environment variable
KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may
cause crashes or silently produce incorrect results. For more information, please see
http://openmp.llvm.org/
Abort trap: 6
Note
This error is specific to macOS and is associated with the challenge of handling multiple copies of OpenMP runtime libraries. It is not specific to the detkit package itself.
Workaround Attempt:
The above error message suggests a workaround to set the environment variable KMP_DUPLICATE_LIB_OK=TRUE
. However, using this workaround may lead to the following error:
Segmentation fault: 11
Solution:
To resolve this issue, follow these steps:
If you have previously set the
KMP_DUPLICATE_LIB_OK
environment variable toTRUE
, unset it by running the following command:unset KMP_DUPLICATE_LIB_OK
Next, disable or remove the Math Kernel Library by:
conda install nomkl conda remove mkl mkl-service
By following these steps, you should be able to resolve the mentioned errors when using the slq
method on macOS.