Python 如何在GoogleColab上安装auto sklearn?
我想使用。我使用了来自此的代码。所有软件包都已安装。但我犯了这样的错误Python 如何在GoogleColab上安装auto sklearn?,python,scikit-learn,google-colaboratory,Python,Scikit Learn,Google Colaboratory,我想使用。我使用了来自此的代码。所有软件包都已安装。但我犯了这样的错误 !curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip install !pip install auto-sklearn import autosklearn.classification -------------------------------------
!curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip install
!pip install auto-sklearn
import autosklearn.classification
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-9-f7b2b884019b> in <module>()
24 from keras.callbacks import EarlyStopping
25 from keras.metrics import categorical_accuracy
---> 26 import autosklearn.classification
27
28
/usr/local/lib/python3.6/dist-packages/autosklearn/classification.py in <module>()
----> 1 from autosklearn.estimators import AutoSklearnClassifier
/usr/local/lib/python3.6/dist-packages/autosklearn/estimators.py in <module>()
3 import numpy as np
4
----> 5 from autosklearn.automl import AutoMLClassifier, AutoMLRegressor
6 from autosklearn.util.backend import create
/usr/local/lib/python3.6/dist-packages/sklearn/ensemble/base.py in <module>()
12 from ..base import BaseEstimator
13 from ..base import MetaEstimatorMixin
---> 14 from ..utils import _get_n_jobs, check_random_state
15 from ..externals import six
16 from abc import ABCMeta, abstractmethod
ImportError: cannot import name '_get_n_jobs'
!卷曲https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt |xargs-n1-l1pip安装
!pip安装自动学习
导入autosklearn.classification
---------------------------------------------------------------------------
ImportError回溯(最近一次呼叫最后一次)
在()
24从keras.callbacks导入早期终止
25来自keras.metrics导入分类精度
--->26进口自动学习分类
27
28
/usr/local/lib/python3.6/dist-packages/autosklearn/classification.py in()
---->1来自autosklearn。估计器导入autosklearn分类器
/usr/local/lib/python3.6/dist-packages/autosklearn/estimators.py in()
3作为np输入numpy
4.
---->5从autosklearn.automl导入AutoMLClassifier、AutoMLRegressionor
6从autosklearn.util.backend导入创建
/usr/local/lib/python3.6/dist-packages/sklearn/employee/base.py in()
12从..基准进口基准估计器
13从..基本导入元混合
--->14从..utils导入\u获取\u n \u作业,检查\u随机\u状态
15从..外部导入6
16来自abc进口ABCMeta,abstractmethod
ImportError:无法导入名称“\u获取\u作业”
我尝试了指定安装文件夹。但我仍然有相同的错误
谁能帮我一下吗
添加
我尝试了tidylobster和CrepeGoat解决方案。然后我得到了另一条错误消息,如下所示
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _dep_map(self)
2896 try:
-> 2897 return self.__dep_map
2898 except AttributeError:
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in __getattr__(self, attr)
2690 if attr.startswith('_'):
-> 2691 raise AttributeError(attr)
2692 return getattr(self._provider, attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _parsed_pkg_info(self)
2887 try:
-> 2888 return self._pkg_info
2889 except AttributeError:
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in __getattr__(self, attr)
2690 if attr.startswith('_'):
-> 2691 raise AttributeError(attr)
2692 return getattr(self._provider, attr)
AttributeError: _pkg_info
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
<ipython-input-2-e20ebb276309> in <module>()
5 get_ipython().system('pip install auto-sklearn')
6
----> 7 import autosklearn.classification
/usr/local/lib/python3.6/dist-packages/autosklearn/__init__.py in <module>()
16 '''
17
---> 18 dependencies.verify_packages(__MANDATORY_PACKAGES__)
19
20 if os.name != 'posix':
/usr/local/lib/python3.6/dist-packages/autosklearn/util/dependencies.py in verify_packages(packages)
25 operation = match.group('operation1')
26 version = match.group('version1')
---> 27 _verify_package(name, operation, version)
28 else:
29 raise ValueError('Unable to read requirement: %s' % package)
/usr/local/lib/python3.6/dist-packages/autosklearn/util/dependencies.py in _verify_package(name, operation, version)
32 def _verify_package(name, operation, version):
33 try:
---> 34 module = pkg_resources.get_distribution(name)
35 installed_version = LooseVersion(module.version)
36 except pkg_resources.DistributionNotFound:
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in get_distribution(dist)
477 dist = Requirement.parse(dist)
478 if isinstance(dist, Requirement):
--> 479 dist = get_provider(dist)
480 if not isinstance(dist, Distribution):
481 raise TypeError("Expected string, Requirement, or Distribution", dist)
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in get_provider(moduleOrReq)
353 """Return an IResourceProvider for the named module or requirement"""
354 if isinstance(moduleOrReq, Requirement):
--> 355 return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
356 try:
357 module = sys.modules[moduleOrReq]
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in require(self, *requirements)
896 included, even if they were already activated in this working set.
897 """
--> 898 needed = self.resolve(parse_requirements(requirements))
899
900 for dist in needed:
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)
790
791 # push the new requirements onto the stack
--> 792 new_requirements = dist.requires(req.extras)[::-1]
793 requirements.extend(new_requirements)
794
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in requires(self, extras)
2633 def requires(self, extras=()):
2634 """List of Requirements needed for this distro if `extras` are used"""
-> 2635 dm = self._dep_map
2636 deps = []
2637 deps.extend(dm.get(None, ()))
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _dep_map(self)
2897 return self.__dep_map
2898 except AttributeError:
-> 2899 self.__dep_map = self._compute_dependencies()
2900 return self.__dep_map
2901
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _compute_dependencies(self)
2906 reqs = []
2907 # Including any condition expressions
-> 2908 for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
2909 reqs.extend(parse_requirements(req))
2910
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _parsed_pkg_info(self)
2888 return self._pkg_info
2889 except AttributeError:
-> 2890 metadata = self.get_metadata(self.PKG_INFO)
2891 self._pkg_info = email.parser.Parser().parsestr(metadata)
2892 return self._pkg_info
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in get_metadata(self, name)
1408 if not self.egg_info:
1409 return ""
-> 1410 value = self._get(self._fn(self.egg_info, name))
1411 return value.decode('utf-8') if six.PY3 else value
1412
/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py in _get(self, path)
1520
1521 def _get(self, path):
-> 1522 with open(path, 'rb') as stream:
1523 return stream.read()
1524
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/scikit_learn-0.20.1.dist-info/METADATA'
---------------------------------------------------------------------------
AttributeError回溯(最近一次呼叫上次)
/usr/local/lib/python3.6/dist-packages/pkg\u-resources/\uuuuuu-init\uuuuuuuuu.py-in\u-dep\u-map(self)
2896尝试:
->2897返回自我部门地图
2898除属性错误外:
/usr/local/lib/python3.6/dist-packages/pkg_-resources/__-init__;.py-in ___-getattr(self,attr)
2690如果属性开始使用(“”“):
->2691提高属性错误(属性)
2692返回getattr(自提供程序,attr)
AttributeError:\u DistInfoDistribution\u dep\u map
在处理上述异常期间,发生了另一个异常:
AttributeError回溯(最近一次呼叫上次)
/usr/local/lib/python3.6/dist-packages/pkg_-resources/_-init__;u.py in_-parsed_-pkg_-info(self)
2887尝试:
->2888返回自我包装信息
2889除属性错误外:
/usr/local/lib/python3.6/dist-packages/pkg_-resources/__-init__;.py-in ___-getattr(self,attr)
2690如果属性开始使用(“”“):
->2691提高属性错误(属性)
2692返回getattr(自提供程序,attr)
AttributeError:_pkg_info
在处理上述异常期间,发生了另一个异常:
FileNotFoundError回溯(最近一次调用上次)
在()
5 get_ipython().system('pip install auto sklearn')
6.
---->7导入autosklearn.classification
/usr/local/lib/python3.6/dist-packages/autosklearn/__-init__;u.py-in()
16 '''
17
--->18依赖项。验证\u包(\u强制\u包)
19
20如果os.name!='posix':
/验证_包(包)中的usr/local/lib/python3.6/dist-packages/autosklearn/util/dependencies.py
25操作=匹配。组('operation1')
26 version=match.group('version1')
--->27验证包(名称、操作、版本)
28.其他:
29 raise VALUERROR('无法读取要求:%s'%1!')
/usr/local/lib/python3.6/dist-packages/autosklearn/util/dependencies.py in_verify_包(名称、操作、版本)
32 def验证包(名称、操作、版本):
33尝试:
--->34模块=打包资源。获取分发(名称)
35已安装版本=未安装版本(模块版本)
36除pkg_resources.DistributionNotFound外:
/get_发行版(dist)中的usr/local/lib/python3.6/dist-packages/pkg_-resources/__-init__u;.py
477 dist=需求解析(dist)
478如果存在(距离,要求):
-->479 dist=获取提供程序(dist)
480如果不存在(距离、分布):
481 raise TypeError(“预期字符串、要求或分发”,dist)
/获取提供程序(moduleOrReq)中的usr/local/lib/python3.6/dist-packages/pkg_-resources/__-init__.py
353“返回指定模块或需求的IResourceProvider”
354如果存在(模块RREQ,要求):
-->355返回工作集。查找(moduleOrReq)或要求(str(moduleOrReq))[0]
356试试:
357模块=系统模块[moduleOrReq]
/usr/local/lib/python3.6/dist packages/pkg_resources/__init__.py in require(self,*requirements)
包括896,即使它们已在此工作集中激活。
897 """
-->898 needed=self.resolve(解析需求(需求))
899
900,用于需要的地区:
/usr/local/lib/python3.6/dist packages/pkg_resources/__init__.py解析(self、requirements、env、installer、replace_、extras)
790
791#将新需求推到堆栈上
-->792新需求=地区需求(额外需求)[:-1]
793要求。扩展(新要求)
794
/usr/local/lib/python3.6/dist-packages/pkg_-resources/__-init__;.py-in-requires(self,extras)
2633 def需要(自身,额外=()):
2634“如果使用了'extras',则此发行版所需的要求列表”
->2635 dm=自分解图
2636 deps=[]
2637 deps.extend(dm.get(None,()))
/usr/local/lib/python3.6/dist-packages/pkg\u-resources/\uuuuuu-init\uuuuuuuuu.py-in\u-dep\u-map(self)
2897返回自我部门地图
2898除属性错误外:
->2899 self.\u dep\u map=self.\u compute\u dependencie
!sudo apt-get install build-essential swig
!curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip install
!pip install auto-sklearn
import autosklearn.classification
!sudo apt-get update
!sudo apt-get install build-essential swig
!sudo apt-get upgrade
!curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip install
!pip install auto-sklearn
import autosklearn.classification
!sudo apt-get install build-essential swig
!curl https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt | xargs -n 1 -L 1 pip install
!pip install auto-sklearn
for _ in range(3):
try:
import autosklearn.classification
break
except:
pass
else:
raise ImportError("failed to import from autosklearn")