首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >即使更新了所有库,导入shap也会发生错误。

即使更新了所有库,导入shap也会发生错误。
EN

Stack Overflow用户
提问于 2022-09-25 00:32:31
回答 1查看 261关注 0票数 -1

当我导入shap时,会得到以下错误。

我尝试重新安装shap并更新condanumpynumballvmlite

有趣的是,jupyter笔记本中的llvmlite版本是0.38.0,但是错误发生在下面。

意外异常格式异常。回到标准异常

代码语言:javascript
运行
复制
Traceback (most recent call last):
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3369, in run_code
    ----------
  File "C:\Users\user\AppData\Local\Temp\ipykernel_22980\3975714860.py", line 1, in <cell line: 1>
    import shap
  File "C:\Users\user\anaconda3\lib\site-packages\shap\__init__.py", line 12, in <module>
    from ._explanation import Explanation, Cohorts
  File "C:\Users\user\anaconda3\lib\site-packages\shap\_explanation.py", line 12, in <module>
    from .utils._general import OpChain
  File "C:\Users\user\anaconda3\lib\site-packages\shap\utils\__init__.py", line 1, in <module>
    from ._clustering import hclust_ordering, partition_tree, partition_tree_shuffle, delta_minimization_order, hclust
  File "C:\Users\user\anaconda3\lib\site-packages\shap\utils\_clustering.py", line 4, in <module>
    from numba import jit
  File "C:\Users\user\anaconda3\lib\site-packages\numba\__init__.py", line 199, in <module>
    _ensure_llvm()
  File "C:\Users\user\anaconda3\lib\site-packages\numba\__init__.py", line 111, in _ensure_llvm
    raise ImportError(msg)
ImportError: Numba requires at least version 0.38.0 of llvmlite.
Installed version is 0.37.0.
Please update llvmlite.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 1982, in showtraceback
    'the full traceback.\n']
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 1118, in structured_traceback
    return FormattedTB.structured_traceback(
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 1012, in structured_traceback
    return VerboseTB.structured_traceback(
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 865, in structured_traceback
    formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 818, in format_exception_as_a_whole
    frames.append(self.format_record(r))
  File "C:\Users\user\anaconda3\lib\site-packages\IPython\core\ultratb.py", line 736, in format_record
    result += ''.join(_format_traceback_lines(frame_info.lines, Colors, self.has_colors, lvals))
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\utils.py", line 145, in cached_property_wrapper
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\core.py", line 698, in lines
    pieces = self.included_pieces
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\utils.py", line 145, in cached_property_wrapper
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\core.py", line 649, in included_pieces
    pos = scope_pieces.index(self.executing_piece)
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\utils.py", line 145, in cached_property_wrapper
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "C:\Users\user\anaconda3\lib\site-packages\stack_data\core.py", line 628, in executing_piece
    return only(
  File "C:\Users\user\anaconda3\lib\site-packages\executing\executing.py", line 164, in only
    raise NotOneValueFound('Expected one value, found 0')
executing.executing.NotOneValueFound: Expected one value, found 0

在我尝试用"conda update llvmlite“更新之后。

我发现了一个错误如下。我该怎么做?

代码语言:javascript
运行
复制
(base) C:\Users\user>conda update llvmlite
Collecting package metadata (current_repodata.json): failed

CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.

Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
EN

回答 1

Stack Overflow用户

发布于 2022-09-25 06:11:18

在导入时,numballvm版本之间存在冲突。

仔细阅读以下几行:

代码语言:javascript
运行
复制
ImportError: Numba requires at least version 0.38.0 of llvmlite.
Installed version is 0.37.0.
Please update llvmlite.

尝试:

代码语言:javascript
运行
复制
conda list llvmlite

或者,如果需要

代码语言:javascript
运行
复制
conda update llvmlite

正如您声称您已经有正确的llvmlite路径,我认为最短的路径是要做的。

代码语言:javascript
运行
复制
conda deactivate
pip install -U llvmlite

否则,搜索$PATH / env定义中的问题

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73841398

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档