New upgrade broke from_numpy?

I just upgraded to 0.6.27 and some of the old code now broke?


import numpy as np
import taichi as ti
ti.init(arch=ti.cuda)   # use gpu

pixels = ti.field(ti.f32, (1024, 512))

arr = np.random.rand(1024, 512)
pixels.from_numpy(arr)   # load numpy data into taichi fields

and the error:
[Taichi] mode=release
[Taichi] preparing sandbox at /tmp/taichi-6tbgid05
[Taichi] version 0.6.27, llvm 10.0.0, commit a34a6128, linux, python 3.7.8
[I 08/16/20 14:59:11.218] [] Graphical python shell detected, using wrapped sys.stdout
[Taichi] Starting on arch=cuda
[Taichi] materializing…
Traceback (most recent call last):

File “/home/ling/proj-taichi/test/”, line 16, in
pixels.from_numpy(arr) # load numpy data into taichi fields

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 212, in wrapped
return func(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 192, in from_numpy
ext_arr_to_tensor(arr, self)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 578, in wrapped
return primal(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 34, in new_call
ret = old_call(*args, **kwargs)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 505, in call
self.materialize(key=key, args=args, arg_features=arg_features)

File “/home/ling/.local/lib/python3.7/site-packages/taichi/lang/”, line 358, in materialize

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/”, line 81, in getsourcefile
return get_inspector().getsourcefile(object)

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/”, line 40, in getsourcefile
return ins.file

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/”, line 28, in file
ret = self._file()

File “/home/ling/.local/lib/python3.7/site-packages/sourceinspect/”, line 15, in _file
lineno = self.getlineno()

AttributeError: ‘IPythonInspector’ object has no attribute ‘getlineno’

Can someone help?

Sorry about the confusion here, it’s probably a bug in sourceinspect. Try this command:

pip uninstall sourceinspect

And taichi should be functional again with just a warning.

1 Like