Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing libiomp5.dylib, but found libomp.dylib already initialized. #78490

Closed
datumbox opened this issue May 25, 2022 · 26 comments
Closed
Assignees
Labels
dependency issue module: regression It used to work, and now it doesn't topic: binaries topic: build triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Milestone

Comments

@datumbox
Copy link
Contributor

datumbox commented May 25, 2022

🐛 Describe the bug

The issue appears on MacOS py3.8, it started after updating to the latest nightly 1.13.0.dev20220525-py3.8_0 from core (previously I was at 1.12.0.dev20220309-py3.8_0, so the issue could have been introduced earlier than May 25th). I'm receiving the following after importing numpy and pytorch together:

$ python -c "import numpy;import torch"
OMP: Error pytorch/vision#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/.
python3 -mtorch.utils.collect_env
Collecting environment information...
PyTorch version: 1.13.0.dev20220525
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.32.21)
CMake version: version 3.18.4
Libc version: N/A

Python version: 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:50:38)  [Clang 11.1.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] efficientnet-pytorch==0.7.1
[pip3] mypy==0.931
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.4
[pip3] torch==1.13.0.dev20220525
[pip3] torchdata==0.4.0a0+652986b
[pip3] torchvision==0.14.0a0+9a72fd6
[pip3] torchviz==0.0.2
[conda] blas                      2.112                       mkl    conda-forge
[conda] blas-devel                3.9.0              12_osx64_mkl    conda-forge
[conda] efficientnet-pytorch      0.7.1                    pypi_0    pypi
[conda] libblas                   3.9.0              12_osx64_mkl    conda-forge
[conda] libcblas                  3.9.0              12_osx64_mkl    conda-forge
[conda] liblapack                 3.9.0              12_osx64_mkl    conda-forge
[conda] liblapacke                3.9.0              12_osx64_mkl    conda-forge
[conda] mkl                       2021.4.0           h89fa619_689    conda-forge
[conda] mkl-devel                 2021.4.0           h694c41f_690    conda-forge
[conda] mkl-include               2021.4.0           hf224eb6_689    conda-forge
[conda] numpy                     1.22.4           py38h3ad0702_0    conda-forge
[conda] pytorch                   1.13.0.dev20220525         py3.8_0    pytorch-nightly
[conda] torchdata                 0.4.0a0+652986b          pypi_0    pypi
[conda] torchvision               0.14.0a0+9a72fd6           dev_0    <develop>
[conda] torchviz                  0.0.2                    pypi_0    pypi

Strangely, importing first torch works:

python -c "import torch;import numpy;print('works')"
works

Setting KMP_DUPLICATE_LIB_OK=TRUE as env var solves the issue while invoking from console:

KMP_DUPLICATE_LIB_OK=TRUE python -c "import numpy;import torch;print('works')"                                         
works

Sometimes I get segfaults thought, this doesn't seem like a stable solution.

Versions

Latest Core nightly (20220525).

@datumbox
Copy link
Contributor Author

I've ended "fixing" the issue by wiping my conda setup, moving to py3.10 and reinstalling dependencies. The issue was definitely not related to TorchVision as I managed to reproduce it only using Core. It could be related to some weird dependency on my system though.

As discussed with @atalman I'll leave the issue open just in case this is something suspicious that needs to be investigated on the future. I know there were a bunch of macOS changes recently on OK. Feel free to close or move to Core.

@atalman atalman self-assigned this May 25, 2022
@malfet
Copy link
Contributor

malfet commented May 25, 2022

@datumbox you should have run python3 -mtorch.utils.collect_env and posted results here. What I suspect has happened: in your env you've installed PyTorch from wheels, but numpy from conda-forge

@atalman
Copy link
Contributor

atalman commented May 25, 2022

Looks like its conda issue, I was able to reproduce this:

conda install pytorch torchvision torchaudio -c pytorch-nightly

 python -c "import numpy;import torch"
OMP: Error pytorch/vision#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/.
Abort trap: 6

@malfet
Copy link
Contributor

malfet commented May 25, 2022

@atalman can you please run python3 -mtorch.utils.collect_env and post results here?

@atalman
Copy link
Contributor

atalman commented May 25, 2022

Here they are, this config was failing

python3 -mtorch.utils.collect_env
Collecting environment information...
PyTorch version: 1.13.0.dev20220525
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.3)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.7 (default, Sep 16 2021, 08:50:36)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.20.3
[pip3] numpydoc==1.1.0
[pip3] torch==1.13.0.dev20220525
[pip3] torchaudio==0.12.0.dev20220525
[pip3] torchvision==0.14.0.dev20220525
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           hecd8cb5_637  
[conda] mkl-service               2.4.0            py39h9ed2024_0  
[conda] mkl_fft                   1.3.1            py39h4ab4a9b_0  
[conda] mkl_random                1.2.2            py39hb2f4e1b_0  
[conda] numpy                     1.20.3           py39h4b4dc7a_0  
[conda] numpy-base                1.20.3           py39he0bd621_0  
[conda] numpydoc                  1.1.0              pyhd3eb1b0_1  
[conda] pytorch                   1.13.0.dev20220525         py3.9_0    pytorch-nightly
[conda] torch                     1.12.0                   pypi_0    pypi
[conda] torchaudio                0.12.0.dev20220511          pypi_0    pypi
[conda] torchvision               0.13.0.dev20220511          pypi_0    pypi

@datumbox
Copy link
Contributor Author

@malfet I've updated the issue with the requested output. In my case your suspicion seems correct which is different from what @atalman reports. Hope it helps. Feel free to move this issue on PyTorch core if you want, as this is not related to TorchVision.

@atalman
Copy link
Contributor

atalman commented May 25, 2022

@datumbox @malfet

Looks like I was able to mitigate this issue by doing following

conda conda uninstall intel-openmp
conda install -c intel openmp
conda install numpy
conda install pytorch torchvision torchaudio -c pytorch-nightly

So looks like problem could be related to openmp

python3 -mtorch.utils.collect_env
Collecting environment information...
PyTorch version: 1.13.0.dev20220525
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 13.1.6 (clang-1316.0.21.2.3)
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.7 (default, Sep 16 2021, 08:50:36)  [Clang 10.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.3
[pip3] torch==1.13.0.dev20220525
[pip3] torchaudio==0.12.0.dev20220525
[pip3] torchvision==0.14.0.dev20220525
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           hecd8cb5_637  
[conda] mkl-service               2.4.0            py39h9ed2024_0  
[conda] mkl_fft                   1.3.1            py39h4ab4a9b_0  
[conda] mkl_random                1.2.2            py39hb2f4e1b_0  
[conda] numpy                     1.22.3           py39h2e5f0a9_0  
[conda] numpy-base                1.22.3           py39h3b1a694_0  
[conda] pytorch                   1.13.0.dev20220525         py3.9_0    pytorch-nightly
[conda] torch                     1.12.0                   pypi_0    pypi
[conda] torchaudio                0.12.0.dev20220511          pypi_0    pypi
[conda] torchvision               0.13.0.dev20220511          pypi_0    pypi

@malfet
Copy link
Contributor

malfet commented May 26, 2022

Ok, can we please clarify the following: what conda package provides libiomp5.dylib? If it's provided by MKL base, that we do not need to bundle it with the package, but rather take it from conda, i.e. following function should not be called when building conda packages for MacOS

def _embed_libiomp(self):

@datumbox datumbox transferred this issue from pytorch/vision May 30, 2022
@malfet malfet added the module: regression It used to work, and now it doesn't label May 30, 2022
@atalman
Copy link
Contributor

atalman commented May 31, 2022

After doing some more research I found out that this error is resolved by

conda remove mkl

however we can reintroduce this issue by installing

conda install numpy-base=1.22.3

which installs following packages:

  numpy-base         pkgs/main/osx-64::numpy-base-1.22.3-py310hfd2de13_0

@ejguan ejguan added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label May 31, 2022
PyTorch Dev Infra Backlog automation moved this from Needs Triage to Done Jun 1, 2022
facebook-github-bot pushed a commit that referenced this issue Jun 2, 2022
Summary:
Fixes #78490

Following command:
```
conda install pytorch torchvision torchaudio -c pytorch-nightly
```

Installs libiomp . Hence we don't want to package libiomp with conda installs. However, we still keep it for libtorch and wheels.

Pull Request resolved: #78632
Approved by: https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/ca7f948806d296727d16233dd82392fa6664aa89

Reviewed By: b0noI

Differential Revision: D36854265

Pulled By: atalman

fbshipit-source-id: 1b9a2f034cac822d9936febaa7b94213c31af19f
@jamt9000
Copy link

I am also getting this with python 3.10 on intel mac and the released pytorch 1.12.0

python -c "import numpy;import torch"
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/.
[1]    40520 abort      python -c "import numpy;import torch"
python3 -mtorch.utils.collect_env
Collecting environment information...
PyTorch version: 1.12.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 13.0.0 (clang-1300.0.29.30)
CMake version: version 3.21.3
Libc version: N/A

Python version: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:03:09) [Clang 13.0.1 ] (64-bit runtime)
Python platform: macOS-12.3.1-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] efficientnet-pytorch==0.6.3
[pip3] numpy==1.22.3
[pip3] torch==1.12.0
[pip3] torchvision==0.13.0
[conda] blas                      1.0                         mkl
[conda] efficientnet-pytorch      0.6.3                    pypi_0    pypi
[conda] mkl                       2021.4.0           h89fa619_689    conda-forge
[conda] mkl-fft                   1.3.1                    pypi_0    pypi
[conda] mkl-random                1.2.2                    pypi_0    pypi
[conda] mkl-service               2.4.0                    pypi_0    pypi
[conda] mkl_fft                   1.3.1           py310h9c6a5af_1    conda-forge
[conda] mkl_random                1.2.2           py310hc081a56_0
[conda] numpy                     1.22.3                   pypi_0    pypi
[conda] numpy-base                1.22.3          py310hfd2de13_0
[conda] pytorch                   1.12.0                 py3.10_0    pytorch
[conda] torch                     1.12.0                   pypi_0    pypi
[conda] torchvision               0.13.0                   pypi_0    pypi

@atalman
Copy link
Contributor

atalman commented Jun 29, 2022

@jamt9000 please use workaround this issue by setting KMP_DUPLICATE_LIB_OK=TRUE python -c "import numpy;import torch;print('works')"
By accident this change was not included in the release 1.12.0

@datumbox
Copy link
Contributor Author

@atalman Thanks for jumping in to fix the issue. I don't see a PR to update TorchVision to point at a different binary. Do we need any action on our side or all changes are done on Core? cc @YosuaMichael

@atalman atalman added this to the 1.12.1 milestone Jun 30, 2022
@atalman
Copy link
Contributor

atalman commented Jun 30, 2022

reopeing, cherry-pick required for 1.12.1

@atalman atalman reopened this Jun 30, 2022
@atalman
Copy link
Contributor

atalman commented Jul 7, 2022

closing for now as it is resolved in master, will be cherry picking it for 1.12.1

atalman added a commit to atalman/pytorch that referenced this issue Jul 21, 2022
…torch#78632)

Summary:
Fixes pytorch#78490

Following command:
```
conda install pytorch torchvision torchaudio -c pytorch-nightly
```

Installs libiomp . Hence we don't want to package libiomp with conda installs. However, we still keep it for libtorch and wheels.

Pull Request resolved: pytorch#78632
Approved by: https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/ca7f948806d296727d16233dd82392fa6664aa89

Reviewed By: b0noI

Differential Revision: D36854265

Pulled By: atalman

fbshipit-source-id: 1b9a2f034cac822d9936febaa7b94213c31af19f
atalman added a commit that referenced this issue Jul 21, 2022
…81873)

Summary:
Fixes #78490

Following command:
```
conda install pytorch torchvision torchaudio -c pytorch-nightly
```

Installs libiomp . Hence we don't want to package libiomp with conda installs. However, we still keep it for libtorch and wheels.

Pull Request resolved: #78632
Approved by: https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/ca7f948806d296727d16233dd82392fa6664aa89

Reviewed By: b0noI

Differential Revision: D36854265

Pulled By: atalman

fbshipit-source-id: 1b9a2f034cac822d9936febaa7b94213c31af19f
mdraw added a commit to StructuralNeurobiologyLab/emcaps that referenced this issue Aug 9, 2022
@samgelman
Copy link

samgelman commented Aug 10, 2022

I'm still getting this problem with 1.12.1. The workaround KMP_DUPLICATE_LIB_OK=TRUE causes a segfault for me. Going to stick with 1.11 until it gets resolved.

Edit: I did some debugging, and if I import wandb before torch, I get the error OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized.. But if I import torch before wandb, everything works. For now I'll just change the order of my imports, but does anyone have any ideas as to what's causing the problem?

@yuanmao
Copy link

yuanmao commented Aug 16, 2022

I have the same issue as @samgelman on my MacOS.

Notably 1.10.1, 1.11.0 works fine but 1.10.2 and 1.12.1 shows:

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/.
Abort trap: 6

One observation is that both 1.10.1 and 1.11.0 also come with libuv installation, which might have made the difference.

The workaround KMP_DUPLICATE_LIB_OK=TRUE causes a segfault.

Below is a working env:

python3 -mtorch.utils.collect_env
Collecting environment information...
PyTorch version: 1.10.1
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.5 (x86_64)
GCC version: Could not collect
Clang version: 12.0.0 (clang-1200.0.31.1)
CMake version: Could not collect
Libc version: N/A

Python version: 3.8.13 (default, Mar 28 2022, 06:16:26)  [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.5
[pip3] torch==1.10.1
[conda] blas                      1.0                         mkl  
[conda] mkl                       2021.4.0           hecd8cb5_637  
[conda] mkl-service               2.4.0            py38h9ed2024_0  
[conda] mkl_fft                   1.3.1            py38h4ab4a9b_0  
[conda] mkl_random                1.2.2            py38hb2f4e1b_0  
[conda] mypy_extensions           0.4.3            py38hecd8cb5_1  
[conda] numpy                     1.21.5           py38h2e5f0a9_3  
[conda] numpy-base                1.21.5           py38h3b1a694_3  
[conda] pytorch                   1.10.1                  py3.8_0    pytorch

@XhxngX2
Copy link

XhxngX2 commented Aug 22, 2022

same issue here... after spending several days fixing this issue, I'm actually quitting doing ML on M1 mac

@sfc-gh-tmathew
Copy link

sfc-gh-tmathew commented Sep 15, 2022

If I install pytorch first in my conda environment, I see the actual files libiomp5.dylib in two places.

~/opt/anaconda3/envs/<my conda env>/lib/libiomp5.dylib
~/opt/anaconda3/envs/<my conda env>/lib/python3.8/site-packages/torch/lib/libiomp5.dylib

I do not get the OpenMP error.

However, if I install jupyter into this environment the file libiomp5.dylib gets updated to a link pointing to libomp.dylib.
~/opt/anaconda3/envs/<my conda env>/lib/libiomp5.dylib -> libomp.dylib
~/opt/anaconda3/envs/<my conda env>/lib/libomp.dylib
~/opt/anaconda3/envs/<my conda env>/lib/python3.8/site-packages/torch/lib/libiomp5.dylib

After which, the error comes back again.

Is there a reason that libiomp5.dylib is present in two locations after pytorch install ?

cemachelen added a commit to cemac/LIFD_GenerativeAdversarialNetworks that referenced this issue Dec 21, 2022
@FreeBlues
Copy link

On my MacBookPro (intel cpu), I got the similar error:

(invokeai) ppt@pptdeMacBook-Pro invokeAI % python scripts/invoke.py --web --host 0.0.0.0
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/
zsh: abort      python scripts/invoke.py --web --host 0.0.0.0
(invokeai) ppt@pptdeMacBook-Pro invokeAI %

Add the env var, get a segment fault error:

(invokeai) ppt@pptdeMacBook-Pro invokeAI % export KMP_DUPLICATE_LIB_OK=TRUE
(invokeai) ppt@pptdeMacBook-Pro invokeAI % python scripts/invoke.py --web --host 0.0.0.0
zsh: segmentation fault  python scripts/invoke.py --web --host 0.0.0.0
(invokeai) ppt@pptdeMacBook-Pro invokeAI % 

I search for libomp5.dylib and libomp.dylib, below is the log:

no libomp.dylib

many libomp5.dylib:

(base) ppt@pptdeMacBook-Pro testInvokeai % find ~/ -name "libiomp5.dylib"
find: /Users/ppt//Library/Application Support/MobileSync: Operation not permitted
...
find: /Users/ppt//Library/Caches/com.apple.ap.adprivacyd: Operation not permitted
/Users/ppt//Github/stable-diffusion/venv/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//Github/stable-diffusion/venv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/kohya_ss/venv/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//Github/kohya_ss/venv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/macSD/macenv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/macSD/macenv/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
find: /Users/ppt//.Trash: Operation not permitted
find: /Users/ppt//Documents: Operation not permitted
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-12.0.0-h0dcd299_1/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-14.0.4-ha654fa7_0/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-14.0.6-h0dcd299_0/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/intel-openmp-2021.4.0-hecd8cb5_3538/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/web-ui/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/web-ui/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/ldm/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-14.0.4-ha654fa7_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/pytorch-1.12.1-py3.10_0/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-14.0.6-h0dcd299_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-15.0.6-h61d9ccf_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/intel-openmp-2021.4.0-hecd8cb5_3538/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/bfirsh/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/bfirsh/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai-2.1/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/modelscope/lib/python3.7/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/modelscope/lib/python3.7/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/ldm/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/train-model/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/train-model/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/fsbang/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/ldm-orig/lib/libiomp5.dylib
(base) ppt@pptdeMacBook-Pro testInvokeai % find ~/ -name "libiomp.dylib" 
find: /Users/ppt//Library/Application Support/MobileSync: Operation not permitted
find: /Users/ppt//Library/Application Support/CallHistoryTransactions: Operation not permitted
find: /Users/ppt//Library/Application Support/CloudDocs/session/db: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.sharedfilelist: Operation not permitted
find: /Users/ppt//Library/Application Support/Knowledge: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.TCC: Operation not permitted
find: /Users/ppt//Library/Application Support/FileProvider: Operation not permitted
find: /Users/ppt//Library/Application Support/AddressBook: Operation not permitted
find: /Users/ppt//Library/Application Support/FaceTime: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.avfoundation/Frecents: Operation not permitted
find: /Users/ppt//Library/Application Support/CallHistoryDB: Operation not permitted
find: /Users/ppt//Library/Assistant/SiriVocabulary: Operation not permitted
find: /Users/ppt//Library/Autosave Information: Operation not permitted
find: /Users/ppt//Library/IdentityServices: Operation not permitted
find: /Users/ppt//Library/Calendars: Operation not permitted
find: /Users/ppt//Library/Messages: Operation not permitted
find: /Users/ppt//Library/HomeKit: Operation not permitted
find: /Users/ppt//Library/Sharing: Operation not permitted
find: /Users/ppt//Library/com.apple.aiml.instrumentation: Operation not permitted
find: /Users/ppt//Library/Mail: Operation not permitted
find: /Users/ppt//Library/Trial: Operation not permitted
find: /Users/ppt//Library/AppleMediaServices: Operation not permitted
find: /Users/ppt//Library/DuetExpertCenter: Operation not permitted
find: /Users/ppt//Library/Accounts: Operation not permitted
find: /Users/ppt//Library/Safari: Operation not permitted
find: /Users/ppt//Library/Biome: Operation not permitted
find: /Users/ppt//Library/IntelligencePlatform: Operation not permitted
find: /Users/ppt//Library/Shortcuts: Operation not permitted
find: /Users/ppt//Library/Suggestions: Operation not permitted
find: /Users/ppt//Library/Weather: Operation not permitted
find: /Users/ppt//Library/Group Containers/group.com.apple.secure-control-center-preferences: Operation not permitted
find: /Users/ppt//Library/Group Containers/group.com.apple.notes: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.VoiceMemos: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.archiveutility: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Maps/Data/Maps: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Home: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Safari: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.iChat: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.CloudDocs.MobileDocumentsFileProvider: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.mail: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Notes: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.news: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.corerecents.recentsd/Data/Library/Recents: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.stocks: Operation not permitted
find: /Users/ppt//Library/PersonalizationPortrait: Operation not permitted
find: /Users/ppt//Library/Metadata/CoreSpotlight: Operation not permitted
find: /Users/ppt//Library/Reminders: Operation not permitted
find: /Users/ppt//Library/Cookies: Operation not permitted
find: /Users/ppt//Library/CoreFollowUp: Operation not permitted
find: /Users/ppt//Library/StatusKit: Operation not permitted
find: /Users/ppt//Library/DoNotDisturb: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.HomeKit: Operation not permitted
find: /Users/ppt//Library/Caches/CloudKit: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.Safari: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.findmy.fmfcore: Operation not permitted
find: /Users/ppt//Library/Caches/FamilyCircle: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.homed: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.findmy.fmipcore: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.ap.adprivacyd: Operation not permitted
find: /Users/ppt//.Trash: Operation not permitted
find: /Users/ppt//Documents: Operation not permitted
(base) ppt@pptdeMacBook-Pro testInvokeai % 

@ffelten
Copy link

ffelten commented Apr 5, 2023

Having the same issue on Pytorch 2 here:

Collecting environment information...
PyTorch version: 2.0.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: macOS 12.3.1 (x86_64)
GCC version: Could not collect
Clang version: 15.0.7
CMake version: version 3.25.2
Libc version: N/A

Python version: 3.10.9 (main, Dec 15 2022, 18:18:30) [Clang 14.0.0 (clang-1400.0.29.202)] (64-bit runtime)
Python platform: macOS-12.3.1-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.24.2
[pip3] torch==2.0.0
[pip3] torchaudio==2.0.1
[pip3] torchvision==0.15.1
[conda] Could not collect

The line KMP_DUPLICATE_LIB_OK=TRUE python -c "import numpy;import torch;print('works')" works on my terminal. However, my program gets stuck somehow.

@ashishgpersonal
Copy link

I am using this on windows11 and getting the same bug. None of the suggested solutions works except for setting the environment variable.

@gernophil
Copy link

This issue still exists for macOS using Rosetta2 (native arm64 works). Haven't found a working solution yet except the env variable.

@jacquesqiao
Copy link

jacquesqiao commented Oct 15, 2023

On my MacBookPro (intel cpu), I got the similar error:

(invokeai) ppt@pptdeMacBook-Pro invokeAI % python scripts/invoke.py --web --host 0.0.0.0
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/
zsh: abort      python scripts/invoke.py --web --host 0.0.0.0
(invokeai) ppt@pptdeMacBook-Pro invokeAI %

Add the env var, get a segment fault error:

(invokeai) ppt@pptdeMacBook-Pro invokeAI % export KMP_DUPLICATE_LIB_OK=TRUE
(invokeai) ppt@pptdeMacBook-Pro invokeAI % python scripts/invoke.py --web --host 0.0.0.0
zsh: segmentation fault  python scripts/invoke.py --web --host 0.0.0.0
(invokeai) ppt@pptdeMacBook-Pro invokeAI % 

I search for libomp5.dylib and libomp.dylib, below is the log:

no libomp.dylib

many libomp5.dylib:

(base) ppt@pptdeMacBook-Pro testInvokeai % find ~/ -name "libiomp5.dylib"
find: /Users/ppt//Library/Application Support/MobileSync: Operation not permitted
...
find: /Users/ppt//Library/Caches/com.apple.ap.adprivacyd: Operation not permitted
/Users/ppt//Github/stable-diffusion/venv/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//Github/stable-diffusion/venv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/kohya_ss/venv/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//Github/kohya_ss/venv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/macSD/macenv/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//Github/macSD/macenv/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
find: /Users/ppt//.Trash: Operation not permitted
find: /Users/ppt//Documents: Operation not permitted
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-12.0.0-h0dcd299_1/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-14.0.4-ha654fa7_0/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/llvm-openmp-14.0.6-h0dcd299_0/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/pkgs/intel-openmp-2021.4.0-hecd8cb5_3538/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/web-ui/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/web-ui/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//.pyenv/versions/anaconda3-2022.05/envs/ldm/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-14.0.4-ha654fa7_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/pytorch-1.12.1-py3.10_0/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-14.0.6-h0dcd299_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/llvm-openmp-15.0.6-h61d9ccf_0/lib/libiomp5.dylib
/Users/ppt//miniconda/pkgs/intel-openmp-2021.4.0-hecd8cb5_3538/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/web-ui/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/bfirsh/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/bfirsh/lib/python3.10/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/invokeai-2.1/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/modelscope/lib/python3.7/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/modelscope/lib/python3.7/site-packages/functorch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/ldm/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/train-model/lib/python3.10/site-packages/torch/.dylibs/libiomp5.dylib
/Users/ppt//miniconda/envs/train-model/lib/python3.10/site-packages/torch/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/fsbang/lib/libiomp5.dylib
/Users/ppt//miniconda/envs/ldm-orig/lib/libiomp5.dylib
(base) ppt@pptdeMacBook-Pro testInvokeai % find ~/ -name "libiomp.dylib" 
find: /Users/ppt//Library/Application Support/MobileSync: Operation not permitted
find: /Users/ppt//Library/Application Support/CallHistoryTransactions: Operation not permitted
find: /Users/ppt//Library/Application Support/CloudDocs/session/db: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.sharedfilelist: Operation not permitted
find: /Users/ppt//Library/Application Support/Knowledge: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.TCC: Operation not permitted
find: /Users/ppt//Library/Application Support/FileProvider: Operation not permitted
find: /Users/ppt//Library/Application Support/AddressBook: Operation not permitted
find: /Users/ppt//Library/Application Support/FaceTime: Operation not permitted
find: /Users/ppt//Library/Application Support/com.apple.avfoundation/Frecents: Operation not permitted
find: /Users/ppt//Library/Application Support/CallHistoryDB: Operation not permitted
find: /Users/ppt//Library/Assistant/SiriVocabulary: Operation not permitted
find: /Users/ppt//Library/Autosave Information: Operation not permitted
find: /Users/ppt//Library/IdentityServices: Operation not permitted
find: /Users/ppt//Library/Calendars: Operation not permitted
find: /Users/ppt//Library/Messages: Operation not permitted
find: /Users/ppt//Library/HomeKit: Operation not permitted
find: /Users/ppt//Library/Sharing: Operation not permitted
find: /Users/ppt//Library/com.apple.aiml.instrumentation: Operation not permitted
find: /Users/ppt//Library/Mail: Operation not permitted
find: /Users/ppt//Library/Trial: Operation not permitted
find: /Users/ppt//Library/AppleMediaServices: Operation not permitted
find: /Users/ppt//Library/DuetExpertCenter: Operation not permitted
find: /Users/ppt//Library/Accounts: Operation not permitted
find: /Users/ppt//Library/Safari: Operation not permitted
find: /Users/ppt//Library/Biome: Operation not permitted
find: /Users/ppt//Library/IntelligencePlatform: Operation not permitted
find: /Users/ppt//Library/Shortcuts: Operation not permitted
find: /Users/ppt//Library/Suggestions: Operation not permitted
find: /Users/ppt//Library/Weather: Operation not permitted
find: /Users/ppt//Library/Group Containers/group.com.apple.secure-control-center-preferences: Operation not permitted
find: /Users/ppt//Library/Group Containers/group.com.apple.notes: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.VoiceMemos: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.archiveutility: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Maps/Data/Maps: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Home: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Safari: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.iChat: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.CloudDocs.MobileDocumentsFileProvider: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.mail: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.Notes: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.news: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.corerecents.recentsd/Data/Library/Recents: Operation not permitted
find: /Users/ppt//Library/Containers/com.apple.stocks: Operation not permitted
find: /Users/ppt//Library/PersonalizationPortrait: Operation not permitted
find: /Users/ppt//Library/Metadata/CoreSpotlight: Operation not permitted
find: /Users/ppt//Library/Reminders: Operation not permitted
find: /Users/ppt//Library/Cookies: Operation not permitted
find: /Users/ppt//Library/CoreFollowUp: Operation not permitted
find: /Users/ppt//Library/StatusKit: Operation not permitted
find: /Users/ppt//Library/DoNotDisturb: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.HomeKit: Operation not permitted
find: /Users/ppt//Library/Caches/CloudKit: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.Safari: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.findmy.fmfcore: Operation not permitted
find: /Users/ppt//Library/Caches/FamilyCircle: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.homed: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.findmy.fmipcore: Operation not permitted
find: /Users/ppt//Library/Caches/com.apple.ap.adprivacyd: Operation not permitted
find: /Users/ppt//.Trash: Operation not permitted
find: /Users/ppt//Documents: Operation not permitted
(base) ppt@pptdeMacBook-Pro testInvokeai % 

@FreeBlues do you find the solution?

@heloowird
Copy link

I tried as the xgboost issue suggested, then solved:

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

@ForceBru
Copy link

ForceBru commented Mar 2, 2024

I'm getting this too when trying to run a torch.compiled function.

In [1]: import torch

In [2]: x = torch.rand(1024 * 4, 1024 * 4)

In [3]: @torch.compile(fullgraph=True)
   ...: def foo2(x):
   ...:     return torch.sin(x) * torch.cos(x)
   ...: 

In [4]: foo2(x)

I get this error:

BackendCompilerFailed: backend='inductor' raised:
CppCompileError: C++ compile error

Command:
g++ /var/folders/61/p7f15sln0gxd7lwbr58cy6f00000gn/T/torchinductor_forcebru/ss/css5cwjigtuxn36hsrmmmsgiiiswsshuzil6goiihsgwgf5i7iuc.cpp -shared -fPIC -Wall -std=c++17 -Wno-unused-variable -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=0 -I/Users/forcebru/.pyenv/versions/3.11.8/lib/python3.11/site-packages/torch/include -I/Users/forcebru/.pyenv/versions/3.11.8/lib/python3.11/site-packages/torch/include/torch/csrc/api/include -I/Users/forcebru/.pyenv/versions/3.11.8/lib/python3.11/site-packages/torch/include/TH -I/Users/forcebru/.pyenv/versions/3.11.8/lib/python3.11/site-packages/torch/include/THC -I/Users/forcebru/.pyenv/versions/3.11.8/include/python3.11 -L/Users/forcebru/.pyenv/versions/3.11.8/lib/python3.11/site-packages/torch/lib -lomp -lc10 -O3 -DNDEBUG -ffast-math -fno-finite-math-only -fno-unsafe-math-optimizations -Xclang -fopenmp -D C10_USING_CUSTOM_GENERATED_MACROS -o /var/folders/61/p7f15sln0gxd7lwbr58cy6f00000gn/T/torchinductor_forcebru/ss/css5cwjigtuxn36hsrmmmsgiiiswsshuzil6goiihsgwgf5i7iuc.so

Output:
In file included from /var/folders/61/p7f15sln0gxd7lwbr58cy6f00000gn/T/torchinductor_forcebru/ss/css5cwjigtuxn36hsrmmmsgiiiswsshuzil6goiihsgwgf5i7iuc.cpp:2:
/var/folders/61/p7f15sln0gxd7lwbr58cy6f00000gn/T/torchinductor_forcebru/26/c26eqbkuxvn72gf7p2xujmqjcwf4bo6lxmp6rwborxnf4gldnimh.h:8:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^~~~~~~
1 error generated.


OpenMP support not found. Please try one of the following solutions:
(1) Set the `CXX` environment variable to a compiler other than Apple clang++/g++ that has builtin OpenMP support;
(2) install OpenMP via conda: `conda install llvm-openmp`;
(3) install libomp via brew: `brew install libomp`;
(4) manually setup OpenMP and set the `OMP_PREFIX` environment variable to point to a path with `include/omp.h` under it.

Okay, I run brew install libomp, it works fine. I launch a new shell, run the same Python code and get the 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/

Looks like I went from having no OpenMP at all to having too much of it?

  • I found libomp.dylib in /usr/local/opt/libomp/lib as expexted
  • Couldn't find libiomp5.dylib anywhere...

@gernophil
Copy link

I installed the libomp.dylib from here, but I don't know how Python should be aware of this, since I only set flags in my .R/Makevars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency issue module: regression It used to work, and now it doesn't topic: binaries topic: build triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Development

Successfully merging a pull request may close this issue.