当我在控制台中运行Python 3.6
Jupyter
笔记本时,出现此错误。
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在2029年2月16日发表评论)对我有用。
brew uninstall libiomp clamp-omp
conda uninstall intel-openmp -n base
conda install -c intel openmp -n myenv
conda install nomkl -n myenv