Mass_spring_3d 的例子win不能运行

您好,非常欢迎您来到太极社区。

您的这个例子,需要预先安装taichi_three,从代码出错信息也可以看出解决方法哈。
pip install taichi_three==0.05

安装taichi_three之后,您再试试看。

你好,已经安装了 taichi_three,还是不能运行

Requirement already satisfied: taichi_three==0.0.5 in d:\devtools\anaconda3\lib\site-packages (0.0.5)

1 Like

有错误消息么?

Traceback (most recent call last):
File “d:\devtools\anaconda3\lib\runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “d:\devtools\anaconda3\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "D:\DevTools\Anaconda3\Scripts\ti.exe_main
.py", line 7, in
File “d:\devtools\anaconda3\lib\site-packages\taichi\main.py”, line 1095, in main
return cli()
File “d:\devtools\anaconda3\lib\site-packages\taichi\main.py”, line 27, in wrapper
result = func(*args, **kwargs)
File “d:\devtools\anaconda3\lib\site-packages\taichi\main.py”, line 88, in call
return getattr(self, args.command)(sys.argv[2:])
File “d:\devtools\anaconda3\lib\site-packages\taichi\main.py”, line 216, in example
runpy.run_path(target, run_name=‘main’)
File “d:\devtools\anaconda3\lib\runpy.py”, line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File “d:\devtools\anaconda3\lib\runpy.py”, line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File “d:\devtools\anaconda3\lib\runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “D:\DevTools\Anaconda3\Lib\site-packages\taichi\examples\mass_spring_3d.py”, line 9, in
if t3.version != (0, 0, 5):
NameError: name ‘t3’ is not defined

Please give me this full output of this, does it say This example needs the extension library Taichi THREE to work. Please run pip install taichi_three==0.0.5 to install it.?

您好,

pip install taichi_three==0.0.5
这条命令已经运行过了,taichi_three==0.0.5已安装,是在 win10 的 anaconda 环境下安装的

Also need taichi_glsl:

pip install taichi_glsl

Hi, after installed taichi_glsl, new error appears.

Running example mass_spring_3d …
[TaiGLSL] version 0.0.11
[Tai3D] version 0.0.5
[Tai3D] Inputs are welcomed at https://github.com/taichi-dev/taichi_three
[Tai3D] Camera control hints: LMB to orbit, MMB to move, RMB to scale
[Taichi] Starting on arch=cuda
Traceback (most recent call last):
File “c:\programdata\anaconda3\lib\runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “c:\programdata\anaconda3\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\ti.exe_main
.py", line 7, in
File “c:\programdata\anaconda3\lib\site-packages\taichi\main.py”, line 1072, in main
return cli()
File “c:\programdata\anaconda3\lib\site-packages\taichi\main.py”, line 28, in wrapper
result = func(*args, **kwargs)
File “c:\programdata\anaconda3\lib\site-packages\taichi\main.py”, line 89, in call
return getattr(self, args.command)(sys.argv[2:])
File “c:\programdata\anaconda3\lib\site-packages\taichi\main.py”, line 220, in example
runpy.run_path(target, run_name=‘main’)
File “c:\programdata\anaconda3\lib\runpy.py”, line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File “c:\programdata\anaconda3\lib\runpy.py”, line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File “c:\programdata\anaconda3\lib\runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “C:\ProgramData\Anaconda3\Lib\site-packages\taichi\examples\simulation\mass_spring_3d.py”, line 139, in
scene.render()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\scene.py”, line 59, in render
self.init()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\common.py”, line 9, in init
self._init()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\scene.py”, line 56, in _init
model.init()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\common.py”, line 9, in init
self._init()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\model.py”, line 67, in _init
self.L2W.init()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\common.py”, line 9, in init
self._init()
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 725, in call
return self._primal(self._kernel_owner, *args, **kwargs)
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 592, in call
key = self.ensure_compiled(*args)
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 583, in ensure_compiled
self.materialize(key=key, args=args, arg_features=arg_features)
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 452, in materialize
taichi_kernel = taichi_kernel.define(taichi_ast_generator)
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 447, in taichi_ast_generator
compiled()
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\transform.py”, line 50, in _init
self.loadIdentity()
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 71, in decorated
return fun.call(*args)
File “c:\programdata\anaconda3\lib\site-packages\taichi\lang\kernel_impl.py”, line 151, in call
ret = self.compiled(*args)
File “c:\programdata\anaconda3\lib\site-packages\taichi_three\transform.py”, line 45, in loadIdentity
self.matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
AttributeError: ‘MatrixField’ object has no attribute ‘assign’

1 Like

I have the same problem as yours.

Hi,
That problem was basically the recent change of Taichi MatrixField API.

A quick solution is to install previous Taichi version like taichi == 0.7.26 to run the mass_spring_3d demo.

it doesn’t work

(base) PS C:\Users\renzhixiong.tom> ti example mass_spring_3d
[Taichi] mode=release
[Taichi] version 0.7.26, llvm 10.0.0, commit e37bdb5e, win, python 3.8.8


** Taichi Programming Language **


Docs: https://taichi.rtfd.io/zh_CN/latest
GitHub: https://github.com/taichi-dev/taichi
Forum: https://forum.taichi.graphics

usage: ti example [-h] [-p] [-P] [-s] {minimal}
ti example: error: argument name: invalid choice: ‘mass_spring_3d’ (choose from ‘minimal’)

Hi,
From the traceback, guess it’s maybe due to malfunction of 0.7.26 CLI. A straightforward solution is by downloading the example and running it manually like
(python mass_spring_3d.py).

thanks, it works.

  1. pip install taichi==0.7.26
  2. pip install taichi_three==0.0.5
  3. pip install taichi_glsl
  4. download examples from GitHub
  5. python mass_spring_3d.py

2 Likes