sklearn OMP:拟合模型时出现错误 #15 [英] sklearn OMP: Error #15 when fitting models

查看:76
本文介绍了sklearn OMP:拟合模型时出现错误 #15的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近卸载了一个运行良好的 Enthought Canopy 32 位副本并安装了 Canopy 1.1.0 版(64 位).当我尝试使用 sklearn 来拟合模型时,我的内核崩溃了,我得到以下信息错误:

I have recently uninstalled a nicely working copy of Enthought Canopy 32-bit and installed Canopy version 1.1.0 (64 bit). When I try to use sklearn to fit a model my kernel crashes, and I get the following error:

The kernel (user Python environment) has terminated with error code 3. This may be due to a bug in your code or in the kernel itself.

Output captured from the kernel process is shown below.

OMP: Error #15: Initializing libiomp5md.dll, but found mk2iomp5md.dll 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/.

同样的代码在 Canopy 的 32 位下运行得很好.代码实际上只是一个linear_model.SGDClassifier(loss='log')的简单拟合(逻辑回归的错误相同,没有尝试其他模型)

The same code was running just fine under Canopy's 32 bit. The code is really just a simple fit of a linear_model.SGDClassifier(loss='log') (same error for Logistic Regression, haven't tried other models)

我该如何解决这个问题?

How do I fix this?

推荐答案

我遇到了同样的问题,来自 numpy 和 canopy 中的冲突安装.通过编写解决它:

I had the same problem, coming from conflicting installations in numpy and from canopy. Resolved it by writing:

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

不是一个优雅的解决方案,但它为我完成了工作.

Not an elegant solution, but it did the job for me.

这篇关于sklearn OMP:拟合模型时出现错误 #15的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆