[SOLVED] After clean built 'tvm._ffi._ctypes.node.NodeBase' object has no attribute 'set_default'


Once I’ve built latest master TVM following guide from documentation I cannot run any example (tried so far tune_relay_x86.py and relay_quick_start.py).

I am getting all the time error

Traceback (most recent call last):
  File "tune_relay_x86.py", line 30, in <module>
    from tvm import relay
  File "/home/tvm_test/python/tvm/relay/__init__.py", line 24, in <module>
    from . import expr_functor
  File "/home/tvm_test/python/tvm/relay/expr_functor.py", line 24, in <module>
    from .op import Op
  File "/home/tvm_test/python/tvm/relay/op/__init__.py", line 20, in <module>
    from .op import get, register, register_schedule, register_compute, register_gradient, \
  File "/home/tvm_test/python/tvm/relay/op/op.py", line 19, in <module>
    import topi
  File "/home/tvm_test/topi/python/topi/__init__.py", line 25, in <module>
    from . import nn
  File "/home/tvm_test/topi/python/topi/nn/__init__.py", line 11, in <module>
    from .dense import *
  File "/home/tvm_test/topi/python/topi/nn/dense.py", line 65, in <module>
    def dense(data, weight, bias=None, out_dtype=None):
  File "/home/tvm_test/python/tvm/target.py", line 256, in fdecorate
    generic_func_node.set_default(fdefault, allow_override=True)
  File "/home/tvm_test/python/tvm/_ffi/_ctypes/node.py", line 75, in __getattr__
    "'%s' object has no attribute '%s'" % (str(type(self)), name))
AttributeError: '<class 'tvm._ffi._ctypes.node.NodeBase'>' object has no attribute 'set_default'

My believe is that environment variables are set correctly:
export TVM_HOME=/home/tvm_test && export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:$TVM_HOME/nnvm/python:${PYTHONPATH}
I’m running Python 3.6.7 if that helps.


rebuilding ffi make cython3 should fix this issue


Could you please explain a bit more how to rebuild it? There was no need to build it at first place AFAIK. I’m just doing make -j4 and that’s it.

build$ make cython3
make: *** No rule to make target 'cython3'.  Stop.


You can run this command in the root dir of tvm


Unfortunately this also doesn’t help. Unless I have to do something extra after rebuilding it?

make cython3
cd python; python3 setup.py build_ext --inplace
/home/.local/lib/python3.6/site-packages/setuptools/dist.py:475: UserWarning: Normalizing '0.6.dev' to '0.6.dev0'
running build_ext
copying build/lib.linux-x86_64-3.6/tvm/_ffi/_cy3/core.cpython-36m-x86_64-linux-gnu.so -> tvm/_ffi/_cy3


I met this error before. This was some ffi version issue and simply running this command worked.


I am not sure what has changed, but after downloading whole repository today one more time and building in clean directory everything works.