Import tvm returns Runtime error (can't find when using docker demo-cpu image

First attempt to try out TVM. I’ve followed tutorials to install TVM from docker (demo-cpu) here

Installed docker engine based on (my host system is CentOS 7).

Then pulled the docker image:

docker pull tvmai/demo-cpu

and launched it. Then i tried to import tvm:

root@wlab3:~# python3
Python 3.6.8 (default, May  7 2019, 14:58:50) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tvm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspace/python/tvm/", line 27, in <module>
    from . import tensor
  File "/workspace/python/tvm/", line 20, in <module>
    from ._ffi.node import NodeBase, NodeGeneric, register_node, convert_to_node
  File "/workspace/python/tvm/_ffi/", line 24, in <module>
    from .object import Object, register_object, _set_class_node
  File "/workspace/python/tvm/_ffi/", line 23, in <module>
    from .base import _FFI_MODE, _RUNTIME_ONLY, check_call, _LIB, c_str
  File "/workspace/python/tvm/_ffi/", line 60, in <module>
    _LIB, _LIB_NAME = _load_lib()
  File "/workspace/python/tvm/_ffi/", line 51, in _load_lib
    lib_path = libinfo.find_lib_path()
  File "/workspace/python/tvm/_ffi/", line 132, in find_lib_path
    raise RuntimeError(message)
RuntimeError: Cannot find the files.
List of candidates:

Relevant env vars are:

declare -x HOME="/workspace"
declare -x LD_LIBRARY_PATH="/opt/sgxsdk/lib64:"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rust/bin:/usr/lib/go-1.10/bin"
declare -x PWD="/workspace"
declare -x PYTHONPATH="python:topi/python"

Shouldn’t .so libraries come pre-built/pre-installed with demo-cpu docker image?


root@wlab3:~# export TVM_HOME=/workspace
root@wlab3:~# export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:$TVM_HOME/nnvm/python:${PYTHONPATH}

didn’t help.

Any advise is welcome.

Well, I guess the documentation is not up to date… says to clone the repo. Say, i’ve cloned it to /<my_path>/tvm. When i run the docker image from the above tvm directory it gets mapped to /workspace. And there is no pre-built libraries in it (obviously).

However, the docker image already comes with the tvm source and - just in a different location: /usr/tvm. Although, that’s an older snapshot of the sources (27-Sep-2019 as of writing this comment).


export TVM_HOME=/usr/tvm  
export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:$TVM_HOME/nnvm/python

solved the original issue, but a new one showed up: exactly the one discussed in Tvm build issue in docker container

Who needs to be notified to update the documentation and/or update the default docker/

1 Like

Hi @emezh, I faced the same problem, did you solve it?

The original problem was solved as I’ve described above. In the end, I gave up using docker container and just built TVM from source following the tutorial

@emezh Thanks, I will try it.