cannot import name 'bilinear_sample_nchw'


I build tvm in CentOS 7 linux, with a llvm 6.0.1 prebuilt version( SUSE-12). And then everything goes fine in the python package installation. I also accelerate my face recognition model (insightface) from 320ms to 70ms in extracting face features for one face picture.

However, our manufacturing environment is SUSE-12 with out GPU. And there is no cmake in that linux. So I copy the built version from CentOS 7 system (i.e., the whole tvm folder and the llvm 6.0.1 prebulit version into SUSE-12. Everything still goes fine in the python package installation. However, when I import nnvm or topi, it report error as follows. Import tvm is successful.

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/ init .py”, line 10, in
from . import frontend
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/ init .py”, line 4, in
from .onnx import from_onnx
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/”, line 24, in
from .onnx_caffe2_utils import dimension_picker, dimension_constraint,
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/frontend/”, line 20, in
from nnvm.compiler import graph_util
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/compiler/ init .py”, line 19, in
from … import top as _top
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/top/ init .py”, line 6, in
from . import tensor
File “/usr/lib/python3.6/site-packages/nnvm-0.8.0-py3.6.egg/nnvm/top/”, line 22, in
import topi
File “/home/wjk/tvm/topi/python/topi/ init .py”, line 25, in
from . import nn
File “/home/wjk/tvm/topi/python/topi/nn/ init .py”, line 6, in
from .deformable_conv2d import *
File “/home/wjk/tvm/topi/python/topi/nn/”, line 23, in
from …cpp.image import bilinear_sample_nchw
ImportError: cannot import name ‘bilinear_sample_nchw’


Same problem here.
The op is registered though, weird.


@broccoli It is imported to python in
Can you check whether it is successful?


@vinx13 I still have the ImportError.
The ops should be in the list returned by:


@broccoli Yes it should. Could you provide more information about your environment?


@vinx13 ok then I found out the problem, the lib is not installed/copied in the lib/python3.5/site-packages/topi.

I’m using python bdist_wheel from the wheel package to build, distribute and install the whl in different virtual environments.

When using python install as documented the library is actually copied (to lib/python3.5/site-packages/topi-0.6.dev0-py3.5.egg/topi/ and it works.

Maybe should be changed to report an error if nothing was found?
Or assert that _LIB is not None?


Did this Question been closed?I have the same problem


see @broccoli 's solution, this is an issue with your installation


It doesn’t work in my case , I use “from …cpp.image import resize” successful in, but error for ‘bilinear_sample_nchw’.


This problem did related to the, do 'export LD_LIBRARY_PATH=/lib/python3.5/site-packages/ topi-0.6.dev0-py3.5.egg/topi then it works.