pytorch / pytorch/TensorRT

❓ undefined reference when Building Torch-TensorRT

Open
#2,624 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question Story: Build & Install & Packaging
Dominant language
Python
Stars
3k
Forks
410
Avg merge
3d 18h
Merged PRs (30d)
78

Description

❓ Question

What you have already tried

I'm trying to build Torch-TensorRT version 2.3.0a0.
I successfully built Torch 2.3.0.dev.

When building Torch-TensorRT, if I comment http_archive for libtorch and libtorch_pre_cxx11_abi and use the new_local_repository for both of them I get an undefined reference error when running sudo PYTHONPATH=$PYTHONPATH python3 setup.py install

Now If I leave http_archive for libtorch and libtorch_pre_cxx11_abi as default I can "successfully" build Torch-TensorRT but when trying to import it to any python code I get:

ImportError: /home/nick/.local/lib/python3.8/site-packages/torch_tensorrt/lib/libtorchtrt.so: undefined symbol: _ZN3c106detail23torchInternalAssertFailEPKcS2_jS2_RKSs

In the pyproject.toml file I can see that Torch.2.3.0 is mandatory for building Torch-TensorRT and that is the version of torch installed and running in my environment.

Not sure on how to proceed since it seems I have all the required packages installed.

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • PyTorch Version (e.g., 1.0): 2.3.0a0+git4aa1f99
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed PyTorch (conda, pip, libtorch, source): source
  • Build command you used (if compiling from source): sudo python3 setup.py build develop
  • Are you using local sources or building from archives: local
  • Python version: 3.8
  • CUDA version: 12.1
  • GPU models and configuration: 2080 ti

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pyproject.toml's PyTorch requirement and the setup.py build/install path, then compare the libtorch http_archive and new_local_repository configurations described in the report. Reproduce the import failure with the listed PyTorch, Ubuntu, Python, and CUDA environment. Done means the build and import work consistently, or the supported compatibility constraint is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.