-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tensorrt==8.5.3.1 from [and-cuda] not available in Python 3.11 #61986
Comments
Hi @jonas-eschle , Thanks for reporting this. I have replicated the reported error with Python3.11 where Tensorrt fails to install with tensorflow[and-cuda] as per attached gist-Py3.11v. However with Python 3.10v the command works fine and installs tensorrt.Attached gist-Py3.10v for reference. |
@SuryanarayanaY Please assign to the TensorFlow GPU team. |
When installing it lists Currently it seems to be:
you may want to check version updates in the metadata |
This is not available for Python 3.11 |
I think the metadata dependencies source hint is only shown in a recent pip version (I see it after upgrading pip). |
That option is only available in 2.14. |
Can we see anywhere that the "TensorFlow GPU team" has acknowledged this issue? Can we expect 2.15.0 to fix? |
Hi @poulsbo , Could you please help triage this issue to the right person? |
Doesn't seem like it, even though there have been multiple issues that have been raised that are related to this. I am a bit disappointed to see that it has been over a month since the release of TF2.14 and it is not possible to even install the latest version. I am not sure how it hasn't been caught in tests. This should be considered a high-priority issue, and we have yet to see any indication of an acknowledgement that the team is aware of the issue, or an estimated timeline for the issue to get fixed. |
@pjannaty is your team aware of this? |
Routing to @cliffwoolley who has purview now. |
The best workaround so far is to use "--extra-index-url https://pypi.nvidia.com". |
Currently even this does not work :(
|
I confirmed with our TensorRT team that TRT 8.5 did not support Python 3.11. This was a matter of timing of release dates: TensorRT 8.5 was first released in early November 2022, and Python 3.11 had only been out for a few days by then, so it didn't get onto that TensorRT release's support matrix in time. TRT 8.6 does support Python 3.11, and our TensorRT releases generally do maintain binary backward compatibility as per semantic versioning, though as it happens here the python packaging was redone between 8.5 and 8.6, so even if you could force pip to ignore the == dependency baked into TensorFlow (which I didn't find any particularly straightforward way to do), the binaries for TRT are installed to a different path with 8.6 than with 8.5, and the RUNPATH settings baked into libtensorflow_cc.so would need updating to use the 8.6 pip package. TensorFlow does actually act appropriately if the TRT library isn't present at runtime, even though pip is treating it as a hard dependency. (There's no such thing in pip as an 'optional dependency'.) It's possible to make a dummy package that tricks pip into moving forward without installing TRT, and then you can run TF (just without TF-TRT). Is that useful? Cliff Woolley |
Would you mind showing how to do this? Thanks! |
As of the latest tensorflow release python -m pip install "tensorflow[and-cuda]==2.15" --extra-index-url https://pypi.nvidia.com I ran a quick test and so far, it seems like everything is working fine. I think that it would be nice to fix the package pinning so that the extra-index doesn't have to be used, but this is farther than I was able to get with TF2.14. EDIT: This was tested on Python 3.11 under Linux. It appears that tensorrt was bumped to 8.6.x so it appears to work as intended. |
@stallam-unb this is great! Thanks! Do you know what CUDA/CuDNN versions does |
@okurman I think it uses 12.2/8.9, seemingly updated from 11.x series CUDA (based on output from
EDIT: Info about
|
Update: So I ran a few more tests, and interestingly, given
I am seeing all sorts of errors about CUDA and Tensor RT that I didn't see in 2.13.x series. |
@stallam-unb the same happening with my installation. |
For TensorRT 8.6 Python packages, TF's RUNPATH would need to have been updated; I'm not sure if that happened when updating the TRT version dependency in TF? This can be worked around with either symlinks or patchelf to update the runpath or just LD_LIBRARY_PATH -- definitely easier than the issue with TF 2.14 and TRT 8.5 and Py3.11. Can we pick one or the other to go after here? |
|
I'll gather up the symlinks for you as soon as I can get to it, but as far as LD_LIBRARY_PATH approach, all you need to do is to get the tensorrt-libs python package install dir into your library path. What seems to have happened is that when the TRT dependency was bumped to 8.6 in 3de4416 , they recognized the addition of the tensorrt-libs package, but didn't follow the pattern of https://github.com/tensorflow/tensorflow/pull/59825/files and add tensorrt-libs to the search paths at https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/tf2tensorrt/BUILD#L73 and https://github.com/tensorflow/tensorflow/blob/master/third_party/xla/third_party/tsl/tsl/cuda/BUILD.bazel#L166 . (@meena-at-work , FYI). |
@cliffwoolley I've not been quite successful with the echo 'TENSORRT_LIBS_PATH=$(dirname $(python -c "import tensorrt_libs;print(tensorrt_libs.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$TENSORRT_LIBS_PATH:$CONDA_PREFIX/lib/:$LD_LIBRARY_PATH' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh Then (tf215) stallam@lambda-scalar:~$ ls $TENSORRT_LIBS_PATH
drwxrwxr-x stallam stallam 4.0 KB Tue Nov 14 16:32:22 2023 .
drwxrwxr-x stallam stallam 16 KB Tue Nov 14 16:33:44 2023 ..
.rw-rw-r-- stallam stallam 1.0 KB Tue Nov 14 16:32:16 2023 __init__.py
drwxrwxr-x stallam stallam 4.0 KB Tue Nov 14 16:32:22 2023 __pycache__
.rw-rw-r-- stallam stallam 226 MB Tue Nov 14 16:32:17 2023 libnvinfer.so.8
.rw-rw-r-- stallam stallam 957 MB Tue Nov 14 16:32:22 2023 libnvinfer_builder_resource.so.8.6.1
.rw-rw-r-- stallam stallam 37 MB Tue Nov 14 16:32:22 2023 libnvinfer_plugin.so.8
.rw-rw-r-- stallam stallam 2.7 MB Tue Nov 14 16:32:22 2023 libnvonnxparser.so.8
.rw-rw-r-- stallam stallam 3.3 MB Tue Nov 14 16:32:22 2023 libnvparsers.so.8 Re-running my test scripts still returns "Tensor RT not found" warning unfortunately. |
Using something similar to the following: When I manually created the symbolic links |
Thanks all for the clues into this issue. I wrote a helper script to set up symlinks to allow tensorflow to discover the missing tensorrt files, this helped me using tensorflow 2.15.1 and tensorrt 8.6.1.
|
Issue type
Build/Install
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
binary
TensorFlow version
2.14.0
Custom code
No
OS platform and distribution
Ubuntu 22.04
Python version
3.11
Current behavior?
tensorrt==8.5.3.1, a pinned dependency in TensorFlow[and-cuda], is only available up to Python 3.10 and therefore fails installing with Python 3.11
Standalone code to reproduce the issue
Installation issue `pip install "tensorflow[and-cuda]>=2.14.0"` with Python 3.11+
Relevant log output
The text was updated successfully, but these errors were encountered: