尝试导入 autosklearn 时 Colab 出错 [英] Error in Colab when trying to import autosklearn

查看:81
本文介绍了尝试导入 autosklearn 时 Colab 出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Google Colab 中使用 Autosklearn,为此我已完成以下步骤:

I'm trying to work with Autosklearn in Google Colab, for which I have done the following steps:

!apt-get install build-essential swig 
!pip install auto-sklearn

当我尝试时出现以下错误

I get the following error when I try to

import autosklearn

IncorrectPackageVersionError: found 'scikit-learn' version 0.22.2.post1 but requires scikit-learn version >=0.23.0

我已尝试执行以下操作:

I have tried to do the following:

!pip install --upgrade scikit-learn

Requirement already up-to-date: scikit-learn in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied, skipping upgrade: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (2.1.0)
Requirement already satisfied, skipping upgrade: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.0.0)
Requirement already satisfied, skipping upgrade: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.4.1)
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.19.4)

!pip install -U scikit-learn

Requirement already up-to-date: scikit-learn in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied, skipping upgrade: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.4.1)
Requirement already satisfied, skipping upgrade: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (2.1.0)
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.19.4)
Requirement already satisfied, skipping upgrade: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn) (1.0.0)

!pip install scikit-learn==0.23.2

Requirement already satisfied: scikit-learn==0.23.2 in /usr/local/lib/python3.6/dist-packages (0.23.2)
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.19.4)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.0.0)
Requirement already satisfied: scipy>=0.19.1 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (1.4.1)
Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.23.2) (2.1.0)

但是当我检查 sklearn 版本时,我看到以下内容:

but when I check the sklearn version I see the following:

import sklearn

print('The scikit-learn version is {}.'.format(sklearn.__version__))

The scikit-learn version is 0.22.2.post1.

当我尝试导入 autosklearn 时仍然出现错误

And I still get the error when I try to import autosklearn

我还能如何将/upgrade 安装到 scikit-learn 0.23.2 版(当前版本)?

How else can I install /upgrade to scikit-learn version 0.23.2 (current version)?

推荐答案

这里的问题是 Colab 在您手动安装新版本(版本 0.23.post1)之前已经在启动时导入了 scikit-learn(版本 0.22.2.post1).2).如果您在安装后重新启动运行时,将使用新版本.

The issue here is that Colab imports scikit-learn already at startup (version 0.22.2.post1), before you manually install the new version (version 0.23.2). If you restart your runtime after the install, the new version will be used.

这篇关于尝试导入 autosklearn 时 Colab 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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