This script
import tvm
import tvm.relay as relay
fails:
File "test-onnx.py", line 4, in <module>
import tvm.relay as relay
File "/usr/local/lib/python3.6/site-packages/tvm/relay/__init__.py", line 27, in <module>
from . import expr_functor
File "/usr/local/lib/python3.6/site-packages/tvm/relay/expr_functor.py", line 24, in <module>
from .op import Op
File "/usr/local/lib/python3.6/site-packages/tvm/relay/op/__init__.py", line 20, in <module>
from .op import get, register, register_schedule, register_compute, register_gradient, \
File "/usr/local/lib/python3.6/site-packages/tvm/relay/op/op.py", line 19, in <module>
import topi
ModuleNotFoundError: No module named 'topi'
because the topi submodule isn't installed.
Thanks for reporting the problem, as per https://docs.tvm.ai/install/from_source.html#python-package-installation we will need to install both topi and tvm as part of the installation.
For future troubleshooting related threads, please open a new thread on https://discuss.tvm.ai/ instead :)
The tvm package did install /usr/local/lib/libtvm_topi.so.
So what's wrong with the python binding then that it complains? It obviously wants something like topi.so or topi.py in its python base dir and it isn't installed.
This means that the package is broken.
I've had a similar problem before, and the solution is to run python setup.py install from topi/python directory. This command installs the Python package named topi.
For me the issue was that the tvm I built was not in PYTHONPATH.
Solution from here:
export TVM_HOME=/path/to/tvm
export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:${PYTHONPATH}
Most helpful comment
I've had a similar problem before, and the solution is to run
python setup.py installfromtopi/pythondirectory. This command installs the Python package namedtopi.