Package "onnx" is not installed. Hint: "pip install tlcpack[tvmc]"

I downloaded source code of TVM and trying to execute tvmc tutorial. I refered the information available at “Install from Source — tvm 0.11.dev0 documentation

tvmc compile --target “llvm” --input-shapes “data:[1,3,224,224]” --output resnet50-v2-7-tvm.tar resnet50-v2-7.onnx

I get the following error Package “onnx” is not installed. Hint: “pip install tlcpack[tvmc]”

I installed tvm by issuing command “pip install apache-tvm”. I am able to execute the tvmc tutorial.

Any suggestions will be helpful.

I tried to install tlcpack. Command is pip install tlcpack -f https://tlcpack.ai/wheels. The response is Collecting tlcpack ERROR: Could not find a version that satisfies the requirement tlcpack (from versions: none) ERROR: No matching distribution found for tlcpack WARNING: You are using pip version 19.2.3, however version 23.0 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command.

Did you include ONNX to your environment as per this tip? https://github.com/apache/tvm/blob/main/gallery/tutorial/tvmc_command_line_driver.py#L105-L112

Hello. I haven’t been checking the status of tlcpack recently. We have been publishing packages on weekly basis in apache-tvm · PyPI, can you test with those?

I got error when I tried to install onnx.

(tvmenv) archana@DESKTOP-55973JC:~/tvmenv/tvm/python$ pip3 install onnx onnxoptimizer Collecting onnx Using cached https://files.pythonhosted.org/packages/6c/f6/215ba9e8d2587755df363170e3be54892b087bad0a99935fe456f7555255/onnx-1.13.0.tar.gz Installing build dependencies … done Getting requirements to build wheel … done Installing backend dependencies … done Preparing wheel metadata … done Collecting onnxoptimizer Using cached https://files.pythonhosted.org/packages/c1/c1/8b55ba0f2db61e542427060837b26e17f61bfbde052d5daeb6868eef5374/onnxoptimizer-0.3.6.tar.gz Collecting protobuf<4,>=3.20.2 (from onnx) Using cached https://files.pythonhosted.org/packages/da/e4/4d62585593e9f962cb02614534f62f930de6a80a0a3784282094a01919b2/protobuf-3.20.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/archana/tvmenv/lib/python3.8/site-packages (from onnx) (4.4.0) Requirement already satisfied: numpy>=1.16.6 in /home/archana/tvmenv/lib/python3.8/site-packages (from onnx) (1.19.5) Building wheels for collected packages: onnx Building wheel for onnx (PEP 517) … error ERROR: Command errored out with exit status 1: command: /home/archana/tvmenv/bin/python3.8 /home/archana/tvmenv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp36own941 cwd: /tmp/pip-install-mtmopxxn/onnx Complete output (206 lines): fatal: not a git repository (or any of the parent directories): .git running bdist_wheel running build running build_py running create_version running cmake_build Using cmake args: [’/usr/bin/cmake’, ‘-DPYTHON_INCLUDE_DIR=/usr/local/include/python3.8’, ‘-DPYTHON_EXECUTABLE=/home/archana/tvmenv/bin/python3.8’, ‘-DBUILD_ONNX_PYTHON=ON’, ‘-DCMAKE_EXPORT_COMPILE_COMMANDS=ON’, ‘-DONNX_NAMESPACE=onnx’, ‘-DPY_EXT_SUFFIX=.cpython-38-x86_64-linux-gnu.so’, ‘-DCMAKE_BUILD_TYPE=Release’, ‘-DONNX_ML=1’, ‘/tmp/pip-install-mtmopxxn/onnx’] – The C compiler identification is GNU 11.3.0 – The CXX compiler identification is GNU 11.3.0 – Detecting C compiler ABI info – Detecting C compiler ABI info - done – Check for working C compiler: /usr/bin/cc - skipped – Detecting C compile features – Detecting C compile features - done – Detecting CXX compiler ABI info – Detecting CXX compiler ABI info - done – Check for working CXX compiler: /usr/bin/c++ - skipped – Detecting CXX compile features – Detecting CXX compile features - done – Found PythonInterp: /home/archana/tvmenv/bin/python3.8 (found version “3.8”) – Found PythonLibs: /usr/local/lib/libpython3.8.a (found version “3.8.0”) – Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.a (found version “3.12.4”) Generated: /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto Generated: /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto Generated: /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-data.proto – Could NOT find pybind11 (missing: pybind11_DIR) – pybind11 v2.9.2 – Found PythonLibs: /usr/local/lib/libpython3.8.a – Performing Test HAS_FLTO – Performing Test HAS_FLTO - Success

– ******** Summary ******** – CMake version : 3.22.1 – CMake command : /usr/bin/cmake – System : Linux – C++ compiler : /usr/bin/c++ – C++ compiler version : 11.3.0 – CXX flags : -Wnon-virtual-dtor – Build type : Release – Compile definitions : __STDC_FORMAT_MACROS – CMAKE_PREFIX_PATH : – CMAKE_INSTALL_PREFIX : /usr/local – CMAKE_MODULE_PATH :

– ONNX version : 1.13.0 – ONNX NAMESPACE : onnx – ONNX_USE_LITE_PROTO : OFF – USE_PROTOBUF_SHARED_LIBS : OFF – Protobuf_USE_STATIC_LIBS : ON – ONNX_DISABLE_EXCEPTIONS : OFF – ONNX_WERROR : OFF – ONNX_BUILD_TESTS : OFF – ONNX_BUILD_BENCHMARKS : OFF

– Protobuf compiler : /usr/bin/protoc – Protobuf includes : /usr/include – Protobuf libraries : /usr/lib/x86_64-linux-gnu/libprotobuf.a – BUILD_ONNX_PYTHON : ON – Python version : – Python executable : /home/archana/tvmenv/bin/python3.8 – Python includes : /usr/local/include/python3.8 – Configuring done – Generating done – Build files have been written to: /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build [ 1%] Running gen_proto.py on onnx/onnx.in.proto Processing /tmp/pip-install-mtmopxxn/onnx/onnx/onnx.in.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto3 generating /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx_pb.py [ 2%] Running C++ protocol buffer compiler on /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-ml.proto Failed to generate mypy stubs: No module named ‘google’ [ 2%] Built target gen_onnx_proto [ 4%] Running gen_proto.py on onnx/onnx-operators.in.proto [ 5%] Running gen_proto.py on onnx/onnx-data.in.proto Processing /tmp/pip-install-mtmopxxn/onnx/onnx/onnx-operators.in.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto3 generating /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx_operators_pb.py [ 7%] Running C++ protocol buffer compiler on /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-operators-ml.proto Processing /tmp/pip-install-mtmopxxn/onnx/onnx/onnx-data.in.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-data.proto Writing /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-data.proto3 generating /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx_data_pb.py [ 8%] Running C++ protocol buffer compiler on /tmp/pip-install-mtmopxxn/onnx/.setuptools-cmake-build/onnx/onnx-data.proto Failed to generate mypy stubs: No module named ‘google’ [ 8%] Built target gen_onnx_operators_proto Failed to generate mypy stubs: No module named ‘google’ [ 8%] Built target gen_onnx_data_proto [ 11%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o [ 11%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-data.pb.cc.o [ 13%] Building CXX object CMakeFiles/onnx_proto.dir/onnx/onnx-operators-ml.pb.cc.o [ 14%] Linking CXX static library libonnx_proto.a [ 23%] Built target onnx_proto [ 25%] Building CXX object CMakeFiles/onnx.dir/onnx/checker.cc.o [ 28%] Building CXX object CMakeFiles/onnx.dir/onnx/common/interned_strings.cc.o [ 28%] Building CXX object CMakeFiles/onnx.dir/onnx/common/assertions.cc.o [ 29%] Building CXX object CMakeFiles/onnx.dir/onnx/common/model_helpers.cc.o [ 34%] Building CXX object CMakeFiles/onnx.dir/onnx/common/path.cc.o [ 34%] Building CXX object CMakeFiles/onnx.dir/onnx/common/ir_pb_converter.cc.o [ 34%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/attr_proto_util.cc.o [ 35%] Building CXX object CMakeFiles/onnx.dir/onnx/common/status.cc.o [ 37%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/defs.cc.o [ 38%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/controlflow/old.cc.o [ 40%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/data_type_utils.cc.o [ 41%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/function.cc.o [ 43%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/generator/defs.cc.o [ 44%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/generator/old.cc.o [ 46%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/logical/defs.cc.o [ 47%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/logical/old.cc.o [ 49%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/math/defs.cc.o [ 50%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/math/old.cc.o [ 52%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/math/utils.cc.o [ 53%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/nn/defs.cc.o [ 55%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/nn/old.cc.o [ 56%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/object_detection/defs.cc.o [ 58%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/object_detection/old.cc.o [ 59%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/optional/defs.cc.o [ 61%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/optional/old.cc.o [ 62%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/parser.cc.o [ 64%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/printer.cc.o [ 65%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/quantization/defs.cc.o [ 67%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/reduction/defs.cc.o [ 68%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/quantization/old.cc.o [ 70%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/reduction/old.cc.o [ 71%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/reduction/utils.cc.o [ 73%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/rnn/defs.cc.o [ 74%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/rnn/old.cc.o [ 76%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/schema.cc.o [ 77%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/sequence/defs.cc.o [ 79%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/shape_inference.cc.o [ 80%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/defs.cc.o [ 82%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/old.cc.o [ 83%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor/utils.cc.o [ 85%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor_proto_util.cc.o [ 86%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/tensor_util.cc.o [ 88%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/traditionalml/defs.cc.o [ 89%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/traditionalml/old.cc.o [ 91%] Building CXX object CMakeFiles/onnx.dir/onnx/defs/training/defs.cc.o [ 92%] Building CXX object CMakeFiles/onnx.dir/onnx/shape_inference/implementation.cc.o [ 94%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/convert.cc.o [ 95%] Building CXX object CMakeFiles/onnx.dir/onnx/version_converter/helper.cc.o [ 97%] Linking CXX static library libonnx.a [ 97%] Built target onnx [ 98%] Building CXX object CMakeFiles/onnx_cpp2py_export.dir/onnx/cpp2py_export.cc.o [100%] Linking CXX shared module onnx_cpp2py_export.cpython-38-x86_64-linux-gnu.so /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libprotobuf.a(arena.o): relocation R_X86_64_TPOFF32 against hidden symbol `_ZN6google8protobuf8internal9ArenaImpl13thread_cache_E’ can not be used when making a shared object /usr/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status gmake[2]: *** [CMakeFiles/onnx_cpp2py_export.dir/build.make:101: onnx_cpp2py_export.cpython-38-x86_64-linux-gnu.so] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:240: CMakeFiles/onnx_cpp2py_export.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 Traceback (most recent call last): File “/home/archana/tvmenv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py”, line 207, in main() File “/home/archana/tvmenv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py”, line 197, in main json_out[‘return_val’] = hook(**hook_input[‘kwargs’]) File “/home/archana/tvmenv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py”, line 140, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 413, in build_wheel return self._build_with_temp_dir([‘bdist_wheel’], ‘.whl’, File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 398, in _build_with_temp_dir self.run_setup() File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 484, in run_setup super(_BuildMetaLegacyBackend, File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/build_meta.py”, line 335, in run_setup exec(code, locals()) File “”, line 358, in File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/init.py”, line 108, in setup return distutils.core.setup(**attrs) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 185, in setup return run_commands(dist) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py”, line 201, in run_commands dist.run_commands() File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 969, in run_commands self.run_command(cmd) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/dist.py”, line 1213, in run_command super().run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 988, in run_command cmd_obj.run() File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py”, line 325, in run self.run_command(“build”) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 318, in run_command self.distribution.run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/dist.py”, line 1213, in run_command super().run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 988, in run_command cmd_obj.run() File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/build.py”, line 132, in run self.run_command(cmd_name) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 318, in run_command self.distribution.run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/dist.py”, line 1213, in run_command super().run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 988, in run_command cmd_obj.run() File “”, line 233, in run File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py”, line 318, in run_command self.distribution.run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/dist.py”, line 1213, in run_command super().run_command(command) File “/tmp/pip-build-env-va8nqcl3/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py”, line 988, in run_command cmd_obj.run() File “”, line 227, in run File “/usr/local/lib/python3.8/subprocess.py”, line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ‘[’/usr/bin/cmake’, ‘–build’, ‘.’, ‘–’, ‘-j’, ‘8’]’ returned non-zero exit status 2.

ERROR: Failed building wheel for onnx Running setup.py clean for onnx Failed to build onnx ERROR: Could not build wheels for onnx which use PEP 517 and cannot be installed directly WARNING: You are using pip version 19.2.3, however version 23.0 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command. (tvmenv) archana@DESKTOP-55973JC:~/tvmenv/tvm/python$

I am able to install onnx as I executed following command export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON". onnx package has been istalled

The pip list command shows onnx (env1) (base) archana@DESKTOP-55973JC:~/onnx$ pip list Package Version


attrs 22.2.0 cloudpickle 2.2.1 decorator 5.1.1 numpy 1.19.5 onnx 1.13.0 onnxoptimizer 0.3.6 pip 19.2.3 protobuf 3.20.3 psutil 5.9.4 scipy 1.10.0 setuptools 41.2.0 tornado 6.2 tvm 0.12.dev155+gcc7def073 typing-extensions 4.4.0 xgboost 1.5.2 WARNING: You are using pip version 19.2.3, however version 23.0 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command.

However, still I get the same error (env1) (base) archana@DESKTOP-55973JC:~/onnx$ tvmc compile --target “llvm” --input-shapes “data:[1,3,224,224]” --output resnet50-v2-7-tvm.tar resnet50-v2-7.onnx [16:12:51] /home/archana/tvmenv/tvm/src/runtime/logging.cc:307: TVM_LOG_DEBUG enables VLOG statements in ‘ir/transform.cc’ up to level 1 [16:12:51] /home/archana/tvmenv/tvm/src/runtime/logging.cc:307: TVM_LOG_DEBUG enables VLOG statements in ‘relay/ir/transform.cc’ up to level 1 Package “onnx” is not installed. Hint: “pip install tlcpack[tvmc]”.(env1) (base) archana@DESKTOP-55973JC:~/onnx$

I am not sure whether I understood the suggestion. Do you want me to execute “pip install apache-tvm”?

I tried installing tlcpack from https://pypi.org/project/apache-tvm. However, I got following errors

ERROR: Could not find a version that satisfies the requirement tlcpack (from versions: none) ERROR: No matching distribution found for tlcpack

(env2) (base) archana@DESKTOP-55973JC:~/onnx$ tvmc compile --target “llvm” --input-shapes “data:[1,3,224,224]” --output resnet50-v2-7-tvm.tar resnet50-v2-7.onnx [12:26:23] /home/archana/tvmenv/tvm/src/runtime/logging.cc:307: TVM_LOG_DEBUG enables VLOG statements in ‘ir/transform.cc’ up to level 1 [12:26:23] /home/archana/tvmenv/tvm/src/runtime/logging.cc:307: TVM_LOG_DEBUG enables VLOG statements in ‘relay/ir/transform.cc’ up to level 1 Package “onnx” is not installed. Hint: “pip install tlcpack[tvmc]”.(env2) (base) archana@DESKTOP-55973JC:~/onnx$ pip install tlcpack -f https://pypi.org/project/apache-tvm Looking in links: https://pypi.org/project/apache-tvm Collecting tlcpack ERROR: Could not find a version that satisfies the requirement tlcpack (from versions: none) ERROR: No matching distribution found for tlcpack WARNING: You are using pip version 19.2.3, however version 23.0 is available. You should consider upgrading via the ‘pip install --upgrade pip’ command. (env2) (base) archana@DESKTOP-55973JC:~/onnx$

I also updated pip ( the command is pip install --upgrade pip)

The reason I ask this is because I need to build tvm from source and install it. I am following steps mentioned in page “Install from Source — tvm 0.11.dev0 documentation

still facing the same problem. python setup.py install is not copying tvm library to python/tvm destination folder. If I copy manually, it is working

Try

pip install onnx
1 Like

Hello, could you try our new apache-tvm official package, rather than tlcpack?

pip install apache-tvm[tvmc]

I encountered an issue with the ONNX version installed. For my version of TVM, ONNX versions later than 1.13.0 are not supported yet.

To resolve this, try running:

python -m pip install onnx==1.13.0

Additionally, ensure you are using the correct Python version if you have multiple versions installed.

The error message:

Package "onnx" is not installed. Hint: "pip install tlcpack[tvmc]"

is misleading because ONNX is already installed, but it’s not the correct version. I suggest improving this error message to be more informative.