当我导入shap
时,会得到以下错误。
我尝试重新安装shap
并更新conda
、numpy
、numba
、llvmlite
。
有趣的是,jupyter笔记本中的llvmlite
版本是0.38.0,但是错误发生在下面。
意外异常格式异常。回到标准异常
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“更新之后。
我发现了一个错误如下。我该怎么做?
(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."))
发布于 2022-09-25 06:11:18
在导入时,numba
和llvm
版本之间存在冲突。
仔细阅读以下几行:
ImportError: Numba requires at least version 0.38.0 of llvmlite.
Installed version is 0.37.0.
Please update llvmlite.
尝试:
conda list llvmlite
或者,如果需要
conda update llvmlite
正如您声称您已经有正确的llvmlite
路径,我认为最短的路径是要做的。
conda deactivate
pip install -U llvmlite
否则,搜索$PATH
/ env
定义中的问题
https://stackoverflow.com/questions/73841398
复制相似问题