royerlab / napari-segment-anything

Segment Anything Model (SAM) native Qt UI
Apache License 2.0
190 stars 17 forks source link

OMP: Error #15: Initializing libiomp5.dylib #13

Closed ktsitsi closed 1 year ago

ktsitsi commented 1 year ago

Platform: OSX Ventura 13.3 (22E252)

Conda env:

name: test_env
channels:
  - conda-forge
dependencies:
  - python=3.9
  - nomkl
  - ca-certificates
  - openssl
  - napari
  - pip:
      - filelock==3.12.0
      - mpmath==1.3.0
      - napari-segment-anything==0.1.4
      - segment-anything==1.0
      - sympy==1.12
      - torch==2.0.1
      - torchvision==0.15.2

When installing napari alongside the latest pip install git+https://github.com/jookuma/napari-segment-anything.git I get the following error when trying to open the widget.

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/.

Tried to find similar issues and recomment conda install nomkl but for me does not seem to work either.

JoOkuma commented 1 year ago

Hi @ktsitsi, I had this issue before in a different project when using torch with numpy and scipy.

It was very hard to fix, and my solution was to use the KMP_DUPLICATE_LIB_OK=TRUE flag.

I'm closing the issue because it's not caused by this package.