Import taichi时出现报错

我在导入taichi时遇到了以下问题:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AM                                     D64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import taichi as tc
[Taichi] mode=release
[E 06/10/20 08:19:59.862] [dynamic_loader.cpp:taichi::DynamicLoader::load_functi                                     on@32] Function cuMemAdvise not found


***********************************
* Taichi Compiler Stack Traceback *
***********************************
0x7fed627abb1: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed634303a: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed626aa02: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed63ed397: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed63ef65c: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed6254299: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed61cfeef: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7fed6132853: taichi::create_instance<taichi::Benchmark> in taichi_core.pyd
0x7feded18584: PyCFunction_Call in python38.dll
0x7feded367b8: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded9b3c3: PyEval_EvalCodeEx in python38.dll
0x7feded9b321: PyEval_EvalCode in python38.dll
0x7feded9a451: PyArena_New in python38.dll
0x7feded9a35b: PyArena_New in python38.dll
0x7feded24a88: PyObject_CallFunctionObjArgs in python38.dll
0x7fedecff4f2: PyVectorcall_Call in python38.dll
0x7fedecff3c3: PySequence_GetItem in python38.dll
0x7feded38119: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded3143f: PyFunction_Vectorcall in python38.dll
0x7feded36953: PyEval_EvalFrameDefault in python38.dll
0x7feded343b7: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded3135d: PyFunction_Vectorcall in python38.dll
0x7fedecf94c7: PyObject_CallMethodObjArgs in python38.dll
0x7fedecf8fd0: PyObject_CallMethodIdObjArgs in python38.dll
0x7feded9c249: Py_read in python38.dll
0x7feded2af9c: PyImport_ImportModuleLevelObject in python38.dll
0x7fededf5796: PyLong_FromNbInt in python38.dll
0x7feded3a601: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded9b3c3: PyEval_EvalCodeEx in python38.dll
0x7feded9b321: PyEval_EvalCode in python38.dll
0x7feded9a451: PyArena_New in python38.dll
0x7feded9a35b: PyArena_New in python38.dll
0x7feded24a88: PyObject_CallFunctionObjArgs in python38.dll
0x7fedecff4f2: PyVectorcall_Call in python38.dll
0x7fedecff3c3: PySequence_GetItem in python38.dll
0x7feded38119: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded3143f: PyFunction_Vectorcall in python38.dll
0x7feded36953: PyEval_EvalFrameDefault in python38.dll
0x7feded343b7: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded3135d: PyFunction_Vectorcall in python38.dll
0x7fedecf94c7: PyObject_CallMethodObjArgs in python38.dll
0x7fedecf8fd0: PyObject_CallMethodIdObjArgs in python38.dll
0x7feded9c249: Py_read in python38.dll
0x7feded2af9c: PyImport_ImportModuleLevelObject in python38.dll
0x7fededf5796: PyLong_FromNbInt in python38.dll
0x7feded3a601: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded9b3c3: PyEval_EvalCodeEx in python38.dll
0x7feded9b321: PyEval_EvalCode in python38.dll
0x7feded9a451: PyArena_New in python38.dll
0x7feded9a35b: PyArena_New in python38.dll
0x7feded24a88: PyObject_CallFunctionObjArgs in python38.dll
0x7fedecff4f2: PyVectorcall_Call in python38.dll
0x7fedecff3c3: PySequence_GetItem in python38.dll
0x7feded38119: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded3143f: PyFunction_Vectorcall in python38.dll
0x7feded36953: PyEval_EvalFrameDefault in python38.dll
0x7feded343b7: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded3135d: PyFunction_Vectorcall in python38.dll
0x7fedecf94c7: PyObject_CallMethodObjArgs in python38.dll
0x7fedecf8fd0: PyObject_CallMethodIdObjArgs in python38.dll
0x7feded9c249: Py_read in python38.dll
0x7feded2af9c: PyImport_ImportModuleLevelObject in python38.dll
0x7fededf5796: PyLong_FromNbInt in python38.dll
0x7feded3a601: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded9b3c3: PyEval_EvalCodeEx in python38.dll
0x7feded9b321: PyEval_EvalCode in python38.dll
0x7feded9a451: PyArena_New in python38.dll
0x7feded9a35b: PyArena_New in python38.dll
0x7feded34205: PyEval_EvalFrameDefault in python38.dll
0x7feded29ca8: PyDict_MergeFromSeq2 in python38.dll
0x7feded35581: PyEval_EvalFrameDefault in python38.dll
0x7feded29ca8: PyDict_MergeFromSeq2 in python38.dll
0x7feded35581: PyEval_EvalFrameDefault in python38.dll
0x7feded29ca8: PyDict_MergeFromSeq2 in python38.dll
0x7feded18c68: PyLong_AsDouble in python38.dll
0x7feded332c9: PyEval_EvalFrameDefault in python38.dll
0x7feded342ce: PyEval_EvalFrameDefault in python38.dll
0x7feded343b7: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded370a2: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded3553d: PyEval_EvalFrameDefault in python38.dll
0x7feded2fc58: PyEval_EvalCodeWithName in python38.dll
0x7feded3553d: PyEval_EvalFrameDefault in python38.dll

untimeError                              Traceback (most recent call last)
<ipython-input-1-df6bf7e353c0> in <module>
----> 1 import taichi as tc

d:\python38\lib\site-packages\taichi\__init__.py in <module>
      1 from taichi.main import main
----> 2 from taichi.core import ti_core
      3 from taichi.core import start_memory_monitoring, is_release, package_roo                                     t
      4 from taichi.misc.util import vec, veci, set_gdb_trigger, set_logging_lev                                     el, info, warn, error, debug, trace, INFO, WARN, ERROR, DEBUG, TRACE
      5 from taichi.core.util import require_version

d:\python38\lib\site-packages\taichi\core\__init__.py in <module>
----> 1 from .util import ti_core, build, format, load_module, start_memory_moni                                     toring, \
      2   is_release, package_root
      3 from .unit import unit
      4
      5 ti_core.build = build

d:\python38\lib\site-packages\taichi\core\util.py in <module>
    476
    477
--> 478 _print_taichi_header()

d:\python38\lib\site-packages\taichi\core\util.py in _print_taichi_header()
    455
    456     supported_archs = ['cpu']
--> 457     if ti_core.with_cuda():
    458         supported_archs.append('cuda')
    459     if ti_core.with_opengl():

RuntimeError: [dynamic_loader.cpp:taichi::DynamicLoader::load_function@32] Funct                                     ion cuMemAdvise not found

请问我应该如何解决?

Looks like https://github.com/taichi-dev/taichi_elements/issues/54#issue-617985471 … We will investigate soon. Thanks for reporting!

一个临时的解决方案:添加 TI_ENABLE_CUDA=0 到你的环境变量。
@yuanming 我们最终的解决方案将会是在with_cuda/with_opengl捕获到错误时,返回False?

1 个赞