gpt4 book ai didi

python - 如何修复 "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized"错误?

转载 作者:行者123 更新时间:2023-12-05 07:23:52 26 4
gpt4 key购买 nike

我在控制台中运行 Python 3.6 Jupyter notebooks 时遇到此错误。

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

我有几个不同版本的 ligomp:

(µ_env) jespinozlt-osx:lib jespinoz$ pwd
/Users/jespinoz/anaconda/envs/µ_env/lib
(µ_env) jespinozlt-osx:lib jespinoz$ ls -lhtr | grep "omp"
-rw-rw-r-- 4 jespinoz tigr 165B Oct 28 2016 libgomp.spec
-rw-rw-r-- 4 jespinoz tigr 108K Oct 28 2016 libgomp.a
-rwxrwxr-x 11 jespinoz tigr 62K Oct 28 2016 libgomp.1.dylib
-rwxrwxr-x 6 jespinoz tigr 489K Oct 27 17:30 libomp.dylib
-rwxrwxr-x 5 jespinoz tigr 176K Mar 14 13:10 libiompstubs5.dylib
-rwxrwxr-x 5 jespinoz tigr 296K Mar 14 13:10 libiomp5_db.dylib
-rwxrwxr-x 5 jespinoz tigr 2.7M Mar 14 13:10 libiomp5.dylib
lrwxr-xr-x 1 jespinoz tigr 15B Apr 10 14:51 libgomp.dylib -> libgomp.1.dylib

一个快速补丁是这样的:

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

我该如何正确解决这个问题?我是否需要删除整个 conda 并重新开始?

最佳答案

我遇到了这个问题并尝试了在 https://github.com/dmlc/xgboost/issues/1715 中描述的许多解决方案.

Alex Evers 的帖子(1ps0 于 2 月 16 日(2029 年)发表评论)对我有用。

brew uninstall libiomp clamp-omp  
conda uninstall intel-openmp -n base
conda install -c intel openmp -n myenv
conda install nomkl -n myenv

关于python - 如何修复 "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55714135/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com