0

I have already followed

My environment is in mac m1.

conda create --name st-transformer python=3.9
conda activate st-transformer

conda install -c conda-forge sentence-transformers

And then

conda install faiss

After that I get the following error:

OMP: Error #15: Initializing libiomp5.dylib, but found libomp.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://www.intel.com/software/products/support/.

I have already followed the above links and spent hours with no luck :-(

So the common solution li[ke yje following does not work/

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

I also tried to debug with no luck:

> export DYLD_PRINT_STATISTICS=1
OMP: Error #15: Initializing libiomp5.dylib, but found libomp.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://www.intel.com/software/products/support/.
``

Any pointer is welcome.


Exploring
  • 2,493
  • 11
  • 56
  • 97
  • check if any of your LD_LIBRARY_PATH contains a copy of openmp, and if so, remove it – OregonTrail Jul 23 '22 at 09:10
  • Can you provide steps pls – Exploring Jul 23 '22 at 09:11
  • I did `echo $LD_LIBRARY_PATH` and it shows nothing – Exploring Jul 23 '22 at 09:11
  • On your shell `set | grep LD` You may see a list of `:` separated paths. Check if any of those dirs contains the dylib. If so, `export LD_LIBRARY_PATH=<“paths:without:that:one”>` – OregonTrail Jul 23 '22 at 09:14
  • There are a bunch of environment variables that you can set to get debugging info from the loader. https://wiki.freepascal.org/macOS_Dynamic_Libraries#Logging_dynamic_loader_events Once you know where the first copy is coming from, you can simply try renaming the file to get it to stop loading. – OregonTrail Jul 23 '22 at 09:21
  • nope - its not there – Exploring Jul 23 '22 at 09:21
  • @OregonTrail manually messing with lib paths is not a good way to solve this. – merv Jul 23 '22 at 21:58
  • This is most likely a channel mixing error (see duplicate). Use `conda-forge` for everything in the environment, not just the packages that are only on `conda-forge`. If that doesn't work, update the question and ping me for reopening. – merv Jul 23 '22 at 22:00

0 Answers0