Python -m taichi example [anything] 跑不了

我的环境是Windows Powershell,pip安装了0.6.7并且确保能跑课堂slide里的短码,但是很遗憾跑不了内置的example。请问如何解决?以下是错误提示:

PS C:\Users\Jack> python -m taichi mpm88
[Taichi] mode=release
[Taichi] version 0.6.7, supported archs: [cpu, cuda, opengl], commit ca4d9dda, python 3.7.6


** Taichi Programming Language **


Running task [mpm88]…
[E 06/02/20 15:57:53.613] [taichi/common/task.h:taichi::ImplementationHolder_Task::create@30] Implementation [task::mpm88] not found!

e[38;2;255;000;255m***********************************
e[0me[38;2;255;000;255m* Taichi Compiler Stack Traceback *
e[0me[38;2;255;000;255m***********************************
e[0me[38;2;255;000;255m0x7ffb5fe69161: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5ff31f2a: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5fd1da51: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5fd0ef73: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5fd15878: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5fd0a756: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb5fd228fb: e[0me[38;2;255;000;000mtaichi::create_instancetaichi::Benchmarke[0me[38;2;255;000;255m in taichi_core.pyd
e[0me[38;2;255;000;255m0x7ffb7f958c55: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959517: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959bdf: e[0me[38;2;255;000;000mPyEval_EvalFrameDefaulte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f941766: e[0me[38;2;255;000;000mPyEval_EvalCodeWithNamee[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9413ea: e[0me[38;2;255;000;000mPyFunction_FastCallDicte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f93f463: e[0me[38;2;255;000;000mPyTuple_Newe[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f951287: e[0me[38;2;255;000;000mPyObject_FastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f95101a: e[0me[38;2;255;000;000mPyObject_FastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9595fe: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959fe2: e[0me[38;2;255;000;000mPyEval_EvalFrameDefaulte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f941766: e[0me[38;2;255;000;000mPyEval_EvalCodeWithNamee[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9595cc: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959bdf: e[0me[38;2;255;000;000mPyEval_EvalFrameDefaulte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f941766: e[0me[38;2;255;000;000mPyEval_EvalCodeWithNamee[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f926cc7: e[0me[38;2;255;000;000mPyErr_Cleare[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f926b9d: e[0me[38;2;255;000;000mPyErr_Cleare[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9589b0: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959517: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959bdf: e[0me[38;2;255;000;000mPyEval_EvalFrameDefaulte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f941766: e[0me[38;2;255;000;000mPyEval_EvalCodeWithNamee[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9595cc: e[0me[38;2;255;000;000mPyMethodDef_RawFastCallKeywordse[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f959bdf: e[0me[38;2;255;000;000mPyEval_EvalFrameDefaulte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f941766: e[0me[38;2;255;000;000mPyEval_EvalCodeWithNamee[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f9413ea: e[0me[38;2;255;000;000mPyFunction_FastCallDicte[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f924e4f: e[0me[38;2;255;000;000mPyObject_Calle[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7fa013c4: e[0me[38;2;255;000;000mPy_UnixMaine[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f970ae7: e[0me[38;2;255;000;000mPyErr_NoMemorye[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f911077: e[0me[38;2;255;000;000mPy_Maine[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ffb7f911052: e[0me[38;2;255;000;000mPy_Maine[0me[38;2;255;000;255m in python37.dll
e[0me[38;2;255;000;255m0x7ff721a41258: e[0me[38;2;255;000;000mUnknown Functione[0me[38;2;255;000;255m in python.exe
e[0me[38;2;255;000;255m0x7ffbd20c7bd4: e[0me[38;2;255;000;000mBaseThreadInitThunke[0me[38;2;255;000;255m in KERNEL32.DLL
e[0me[38;2;255;000;255m0x7ffbd2face51: e[0me[38;2;255;000;000mRtlUserThreadStarte[0me[38;2;255;000;255m in ntdll.dll
e[0mTraceback (most recent call last):
File “C:\Users\Jack\AppData\Local\Programs\Python\Python37\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “C:\Users\Jack\AppData\Local\Programs\Python\Python37\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi_main
.py", line 2, in
main()
File “C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\main.py”, line 497, in main
task = ti.Task(name)
File “C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\core\unit.py”, line 16, in new_init
self.c = getattr(taichi.ti_core, 'create
’ + unit_name)(name)
RuntimeError: [taichi/common/task.h:taichi::ImplementationHolder_Task::create@30] Implementation [task::mpm88] not found!

Hi, please use python -m taichi example mpm88.

犯了个低级错误不好意思 :stuck_out_tongue:
但这个指令还是不行,它总是说我给的案例在example里没有,只能是完整的地址。我把完整的地址黏贴过去依然不行:

PS C:\Users\Jack> python -m taichi example mpm88
[Taichi] mode=release
[Taichi] version 0.6.7, supported archs: [cpu, cuda, opengl], commit ca4d9dda, python 3.7.6


** Taichi Programming Language **


Sorry, mpm88 is not an available example name!
Available example names are: [‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\bitmasked’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\cornell_box’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\euler’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\fractal’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\game_of_life’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\image_io’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\keyboard’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\laplace’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\lists’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mgpcg’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mgpcg_advanced’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\minimal’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\minimization_trivial’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mlp’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mnist’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mpm128’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mpm88’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mpm99’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\mpm_lagrangian_forces’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\nbody_oscillator’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\particle_renderer’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\pbf2d’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\pytorch_tensor_ad’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\pytorch_tensor_io’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\quadtree’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\regression’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\renderer_utils’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\sdf2d’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\sdf_renderer’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\simple_autodiff’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\stable_fluid’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\taichi_logo’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\taichi_sparse’, ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\waterwave’]

然后我copy了一个里面列的地址过去,结果还是:
PS C:\Users\Jack> python -m taichi example ‘C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\bitmasked’
[Taichi] mode=release
[Taichi] version 0.6.7, supported archs: [cpu, cuda, opengl], commit ca4d9dda, python 3.7.6


** Taichi Programming Language **


Sorry, C:\Users\Jack\AppData\Roaming\Python\Python37\site-packages\taichi\examples\bitmasked is not an available example name!
Available example names are: […]

这个 bug 在修了,pr 已 merge ,等待新的 release

1 个赞

抱歉,是bug,目前请直接从github拷贝examples文件夹下的代码运行

感谢各位,我去github下载啦

我之前也遇到了同样的问题,修改了…\site-packages\taichi\文件夹下main.py文件的下面一行代码之后就可以正常运行了
image

没错,对于win应该是’\\‘而不是’/’,已经修复,将在v0.6.8中发布。

1 个赞

直接全路径就行
python -m taichi example D:\Miniconda3\envs\taichi\Lib\site-packages\taichi\examples\euler