从 umap-learn 开始,我得到 numba 错误'Operands must be the same type, got (i32, i64)'



我从Python包umap-learn开始。 下面的代码以 numba 包中的错误终止,该包似乎是在创建复杂性降低器期间由 umap-learn 调用的。

错误如下:

ValueError: Operands must be the same type, got (i32, i64)

我在 Windows 2019.2(运行时版本:11.0.3+12-b304.10 amd64(下编写代码 Windows 10 64。

我使用了我的 google-fu 并发现该错误很可能是由于以下事实引起的:在某种程度上,长变量由 Windows 处理,此时它被转换为 32 位格式(我不知道为什么会发生这种情况以及这实际上意味着什么(这就是 umap 崩溃的地方, 因为它应该在 64 位环境中工作。

我的系统是64位的,所以应该是PyCharm:

PyCharm 2019.2 (Community Edition)
Build #PC-192.5728.105, built on July 23, 2019
Runtime version: 11.0.3+12-b304.10 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 4
Registry: 
Non-Bundled Plugins: R4Intellij

我在学习Python时从未遇到过这样的错误。 当我添加"创建者"行时,错误出现了。

我正在寻找有关在Windows 10上解决问题的建议。我认为这在 Linux 下不会发生,但我宁愿避免双启动我的笔记本电脑,除非没有其他解决方案。

任何帮助将不胜感激。

这是我运行的代码。

免责声明:那里有尚未使用的软件包,但这应该不会造成任何麻烦。

import numpy
from sklearn.datasets import load_iris, load_digits
from sklearn.model_selection import train_test_split
import matplotlib.pyplot
import seaborn
import pandas
import umap
seaborn.set(style='white', context='notebook', rc={'figure.figsize': (14, 10)})
#load iris dataset
iris = load_iris()
#get iris data into pandas dataframe
iris_df = pandas.DataFrame(iris.data, columns=iris.feature_names)
iris_df['species'] = pandas.Series(iris.target).map(dict(zip(range(3), iris.target_names)))
seaborn.pairplot(iris_df, hue='species')
# create reducer
reducer = umap.UMAP()```



Here is the complete error output:
D:LMIPythonsleepwalkvenvScriptspython.exe D:/LMI/Python/sleepwalk/main.py
Traceback (most recent call last):
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbaerrors.py", line 662, in new_error_context
yield
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 258, in lower_block
self.lower_inst(inst)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 301, in lower_inst
val = self.lower_assign(ty, inst)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 459, in lower_assign
return self.lower_expr(ty, value)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 919, in lower_expr
res = self.lower_call(resty, expr)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 711, in lower_call
res = self._lower_call_normal(fnty, expr, signature)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 890, in _lower_call_normal
res = impl(self.builder, argvals, self.loc)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbatargetsbase.py", line 1132, in __call__
res = self._imp(self._context, builder, self._sig, args, loc=loc)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbatargetsbase.py", line 1157, in wrapper
return fn(*args, **kwargs)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbatargetsarrayobj.py", line 3374, in numpy_zeros_nd
ary = _empty_nd_impl(context, builder, arrtype, shapes)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbatargetsarrayobj.py", line 3261, in _empty_nd_impl
arrlen = builder.mul(arrlen, s)
File "D:LMIPythonsleepwalkvenvlibsite-packagesllvmliteirbuilder.py", line 24, in wrapped
% (lhs.type, rhs.type))
ValueError: Operands must be the same type, got (i32, i64)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/LMI/Python/sleepwalk/main.py", line 7, in <module>
import umap
File "D:LMIPythonsleepwalkvenvlibsite-packagesumap__init__.py", line 1, in <module>
from .umap_ import UMAP
File "D:LMIPythonsleepwalkvenvlibsite-packagesumapumap_.py", line 28, in <module>
import umap.sparse as sparse
File "D:LMIPythonsleepwalkvenvlibsite-packagesumapsparse.py", line 9, in <module>
from umap.utils import (
File "D:LMIPythonsleepwalkvenvlibsite-packagesumaputils.py", line 108, in <module>
@numba.njit("f8[:, :, :](i8,i8)")
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbadecorators.py", line 186, in wrapper
disp.compile(sig)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbadispatcher.py", line 693, in compile
cres = self._compiler.compile(args, return_type)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbadispatcher.py", line 76, in compile
status, retval = self._compile_cached(args, return_type)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbadispatcher.py", line 90, in _compile_cached
retval = self._compile_core(args, return_type)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbadispatcher.py", line 108, in _compile_core
pipeline_class=self.pipeline_class)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 972, in compile_extra
return pipeline.compile_extra(func)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 390, in compile_extra
return self._compile_bytecode()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 903, in _compile_bytecode
return self._compile_core()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 890, in _compile_core
res = pm.run(self.status)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler_lock.py", line 32, in _acquire_compile_lock
return func(*args, **kwargs)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 266, in run
raise patched_exception
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 257, in run
stage()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 764, in stage_nopython_backend
self._backend(lowerfn, objectmode=False)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 703, in _backend
lowered = lowerfn()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 690, in backend_nopython_mode
self.metadata)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbacompiler.py", line 1143, in native_lowering_stage
lower.lower()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 177, in lower
self.lower_normal_function(self.fndesc)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 218, in lower_normal_function
entry_block_tail = self.lower_function_body()
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 243, in lower_function_body
self.lower_block(block)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbalowering.py", line 258, in lower_block
self.lower_inst(inst)
File "C:UsersTrixxAppDataLocalProgramsPythonPython37-32libcontextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbaerrors.py", line 670, in new_error_context
six.reraise(type(newerr), newerr, tb)
File "D:LMIPythonsleepwalkvenvlibsite-packagesnumbasix.py", line 659, in reraise
raise value
numba.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Operands must be the same type, got (i32, i64)
File "venvlibsite-packagesumaputils.py", line 131:
def make_heap(n_points, size):
<source elided>
"""
result = np.zeros((3, int(n_points), int(size)), dtype=np.float64)
^
[1] During: lowering "$0.14 = call $0.2($0.10, func=$0.2, args=[Var($0.10, D:LMIPythonsleepwalkvenvlibsite-packagesumaputils.py (131))], kws=[('dtype', Var($0.12, D:LMIPythonsleepwalkvenvlibsite-packagesumaputils.py (131)))], vararg=None)" at D:LMIPythonsleepwalkvenvlibsite-packagesumaputils.py (131)
Process finished with exit code 1

好的, 问题已经解决了(实际上相当尴尬(。 我麻烦的原因是Python解释器实际上是32位版本。替换为 64 位,不再有错误。

相关内容

最新更新