GithubHelp home page GithubHelp logo

Trouble Installing TVM Extension about tvm HOT 9 CLOSED

14jyuan avatar 14jyuan commented on July 28, 2024 1
Trouble Installing TVM Extension

from tvm.

Comments (9)

sanjaybharadwaj avatar sanjaybharadwaj commented on July 28, 2024

I hope you created a symbolic link to llvm-config. By default the llvm-8 installation installs llvm-config-8, so you can create a symbolic link by

ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config

from tvm.

14jyuan avatar 14jyuan commented on July 28, 2024

I just tried creating a symbolic link, but I got the same error. I think it might be an issue with cmake rather than llvm?

from tvm.

bwasti avatar bwasti commented on July 28, 2024

perhaps you need to git submodule update --init --recursive?

if not, after creating that symlink, could you try git clean -xfd and rebuilding with python setup.py install --cmake?

from tvm.

14jyuan avatar 14jyuan commented on July 28, 2024

It fixed my issue with python setup.py install, but it errors when I try to run python setup.py test:

=========================================================== ERRORS ============================================================
_____________________________________________ ERROR collecting test/test_core.py ______________________________________________
ImportError while importing test module '/home/ubuntu/tvm/test/test_core.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_core.py:2: in
from test.util import TVMTest
test/util.py:12: in
import torch_tvm
torch_tvm/init.py:9: in
from ._torch_tvm import *
E ImportError: /home/ubuntu/tvm/torch_tvm/_torch_tvm.cpython-37m-x86_64-linux-gnu.so: undefined symbol: ZN5torch3jit16SubgraphRewriter22RegisterRewritePatternERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9
____________________________________________ ERROR collecting test/test_models.py _____________________________________________
ImportError while importing test module '/home/ubuntu/tvm/test/test_models.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_models.py:6: in
import torch_tvm
torch_tvm/init.py:9: in
from ._torch_tvm import *
E ImportError: /home/ubuntu/tvm/torch_tvm/_torch_tvm.cpython-37m-x86_64-linux-gnu.so: undefined symbol: ZN5torch3jit16SubgraphRewriter22RegisterRewritePatternERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9
___________________________________________ ERROR collecting test/test_operators.py ___________________________________________
ImportError while importing test module '/home/ubuntu/tvm/test/test_operators.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_operators.py:2: in
from test.util import TVMTest
test/util.py:12: in
import torch_tvm
torch_tvm/init.py:9: in
from ._torch_tvm import *
E ImportError: /home/ubuntu/tvm/torch_tvm/_torch_tvm.cpython-37m-x86_64-linux-gnu.so: undefined symbol: ZN5torch3jit16SubgraphRewriter22RegisterRewritePatternERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9
====================================================== warnings summary =======================================================
/home/ubuntu/anaconda3/lib/python3.7/site-packages/pywt/_utils.py:6
/home/ubuntu/anaconda3/lib/python3.7/site-packages/pywt/_utils.py:6: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Iterable

-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================= 1 warnings, 3 error in 1.57 seconds =============================================

from tvm.

14jyuan avatar 14jyuan commented on July 28, 2024

Could the undefined symbol errors have something to do with the PyTorch version?

from tvm.

bwasti avatar bwasti commented on July 28, 2024

Yep, it certainly could be the version of PyTorch, but RegisterRewritePattern has been around for a while. If you're willing, I'd recommend building PyTorch locally. Otherwise, a newer nightly might help.

The other issue might be a mismatch caused by the __cxx11 symbol, which might be resolved by adding -D_GLIBCXX_USE_CXX11_ABI=0 to your build command. I'm going off this StackOverflow post: https://stackoverflow.com/questions/33394934/converting-std-cxx11string-to-stdstring.

More concretely that would mean changing https://github.com/pytorch/tvm/blob/master/CMakeLists.txt#L10 to either

SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")

or

SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")

from tvm.

14jyuan avatar 14jyuan commented on July 28, 2024

I tried doing rebuilding the nightly version of PyTorch and changing the line in CMakeLists.txt, and I think it fixed my previous errors, but now I have new errors with python setup.py test:

_________________________________________________________ ERROR collecting test/test_core.py __________________________________________________________
test/test_core.py:2: in
from test.util import TVMTest
test/util.py:12: in
import torch_tvm
torch_tvm/init.py:7: in
from tvm import relay # This registers all the schedules
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/init.py:23: in
from . import tensor
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/tensor.py:20: in
from ._ffi.node import NodeBase, NodeGeneric, register_node, convert_to_node
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node.py:24: in
from .node_generic import NodeGeneric, convert_to_node, const
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node_generic.py:23: in
from .base import string_types
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:60: in
_LIB, _LIB_NAME = _load_lib()
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:52: in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
../anaconda3/lib/python3.7/ctypes/init.py:356: in init
self._handle = _dlopen(self._name, mode)
E OSError: /home/ubuntu/anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so: undefined symbol: _ZN4llvm14TargetRegistry12lookupTargetERKSsRSs
________________________________________________________ ERROR collecting test/test_models.py _________________________________________________________
test/test_models.py:6: in
import torch_tvm
torch_tvm/init.py:7: in
from tvm import relay # This registers all the schedules
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/init.py:23: in
from . import tensor
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/tensor.py:20: in
from ._ffi.node import NodeBase, NodeGeneric, register_node, convert_to_node
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node.py:24: in
from .node_generic import NodeGeneric, convert_to_node, const
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node_generic.py:23: in
from .base import string_types
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:60: in
_LIB, _LIB_NAME = _load_lib()
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:52: in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
../anaconda3/lib/python3.7/ctypes/init.py:356: in init
self._handle = _dlopen(self._name, mode)
E OSError: /home/ubuntu/anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so: undefined symbol: _ZN4llvm14TargetRegistry12lookupTargetERKSsRSs
_______________________________________________________ ERROR collecting test/test_operators.py _______________________________________________________
test/test_operators.py:2: in
from test.util import TVMTest
test/util.py:12: in
import torch_tvm
torch_tvm/init.py:7: in
from tvm import relay # This registers all the schedules
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/init.py:23: in
from . import tensor
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/tensor.py:20: in
from ._ffi.node import NodeBase, NodeGeneric, register_node, convert_to_node
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node.py:24: in
from .node_generic import NodeGeneric, convert_to_node, const
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/node_generic.py:23: in
from .base import string_types
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:60: in
_LIB, _LIB_NAME = _load_lib()
../anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/base.py:52: in _load_lib
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
../anaconda3/lib/python3.7/ctypes/init.py:356: in init
self._handle = _dlopen(self._name, mode)
E OSError: /home/ubuntu/anaconda3/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so: undefined symbol: _ZN4llvm14TargetRegistry12lookupTargetERKSsRSs
================================================================== warnings summary ===================================================================
/home/ubuntu/anaconda3/lib/python3.7/site-packages/pywt/_utils.py:6
/home/ubuntu/anaconda3/lib/python3.7/site-packages/pywt/_utils.py:6: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Iterable

-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================= 1 warnings, 3 error in 0.90 seconds =========================================================

This seems kind of similar to this: apache/tvm#521, so I think this has something to do with llvm, but I'm not sure how to fix it. I tried setting the LLVM-CONFIG environmental variable to llvm-config-8.0 and I've checked my gcc version (it's 7.4.0), but that doesn't seem to help. I'm running llvm-8.0 and I've created the symbolic link from llvm-config-8. to llvm-config.

Do you have any ideas what else I could try? Sorry about all the questions.

from tvm.

14jyuan avatar 14jyuan commented on July 28, 2024

It worked once I built PyTorch from source! I think the nightly build of PyTorch was causing the errors.

from tvm.

lixiuhong avatar lixiuhong commented on July 28, 2024

It worked once I built PyTorch from source! I think the nightly build of PyTorch was causing the errors.

Which version it is in your case? I have also built from source, but it failed.

from tvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.