[英]How can I fix an "OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized" error?
I get this error when I'm running Python 3.6 Jupyter notebooks in the console.当我在控制台中运行 Python 3.6 Jupyter notebooks 时出现此错误。
OMP: Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized. OMP:错误 #15:正在初始化 libiomp5.dylib,但发现 libomp.dylib 已经初始化。
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. OMP:提示 这意味着 OpenMP 运行时的多个副本已链接到程序中。 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, eg by avoiding static linking of the OpenMP runtime in any library.最好的办法是确保只有一个 OpenMP 运行时链接到进程中,例如避免在任何库中静态链接 OpenMP 运行时。 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.作为一种不安全、不受支持、未记录的解决方法,您可以设置环境变量KMP_DUPLICATE_LIB_OK=TRUE
以允许程序继续执行,但这可能会导致崩溃或静默产生不正确的结果。 For more information, please see http://www.intel.com/software/products/support/ .有关详细信息,请参阅http://www.intel.com/software/products/support/ 。
I have a few different versions of ligomp
:我有几个不同版本的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
A quick patch is this:一个快速补丁是这样的:
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
How can I properly fix this?我该如何正确解决这个问题? Do I need to delete my entire conda and start over?我需要删除整个 conda 并重新开始吗?
I had this problem and tried a number of solutions described at https://github.com/dmlc/xgboost/issues/1715 .我遇到了这个问题并尝试了https://github.com/dmlc/xgboost/issues/1715中描述的许多解决方案。
The posting by Alex Evers (1ps0 commented on Feb 16 (2029)) worked for me. 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
I found a solution from the same source https://github.com/dmlc/xgboost/issues/1715我从同一来源找到了解决方案https://github.com/dmlc/xgboost/issues/1715
This seems to be a problem specific to macOS.这似乎是 macOS 特有的问题。
What worked for me is adding the following lines of code in the beginning.对我有用的是在开头添加以下代码行。
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
PS.附言。 I experienced this while running Keras neural net.我在运行 Keras 神经网络时遇到过这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.