Description
sudo apt-get install python3-libnvinfer
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-libnvinfer : Depends: python3 (< 3.7) but 3.8.2-0ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
Environment
TensorRT Version: 7.2
GPU Type: GTX 2070
Nvidia Driver Version: 450.22
CUDA Version: 11.0
CUDNN Version: 8.0.5.39
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): 3.8.2
Please help me solve this issue. I am trying to install tensorrt python api but nothing working out though c++ api is already installed. This command throws weird dependency error. What should I do? Do I have to recreate my virtual environment for the project and use downgraded version or is there an other alternative. Any guidance will be helpful.
Thank you
Hi @Himanshu01,
Please refer the following doc to validate installation steps you’re following.
Thank you.
I have gone through the installation documentations of tensorrt and followed exact procedure using debian installation
$ ~/ dpkg -l | grep TensorRT
ii libnvinfer-bin 7.2.2-1+cuda11.0 amd64 TensorRT binaries
ii libnvinfer-dev 7.2.2-1+cuda11.0 amd64 TensorRT development libraries and headers
ii libnvinfer-doc 7.2.2-1+cuda11.0 all TensorRT documentation
ii libnvinfer-plugin-dev 7.2.2-1+cuda11.0 amd64 TensorRT plugin libraries
ii libnvinfer-plugin7 7.2.2-1+cuda11.0 amd64 TensorRT plugin libraries
ii libnvinfer-samples 7.2.2-1+cuda11.0 all TensorRT samples
ii libnvinfer7 7.2.2-1+cuda11.0 amd64 TensorRT runtime libraries
ii libnvonnxparsers-dev 7.2.2-1+cuda11.0 amd64 TensorRT ONNX libraries
ii libnvonnxparsers7 7.2.2-1+cuda11.0 amd64 TensorRT ONNX libraries
ii libnvparsers-dev 7.2.2-1+cuda11.0 amd64 TensorRT parsers libraries
ii libnvparsers7 7.2.2-1+cuda11.0 amd64 TensorRT parsers libraries
ii python-libnvinfer 7.2.2-1+cuda11.0 amd64 Python bindings for TensorRT
ii python-libnvinfer-dev 7.2.2-1+cuda11.0 amd64 Python development package for TensorRT
ii tensorrt 7.2.2.3-1+cuda11.0 amd64 Meta package of TensorRT
The verification commands run without errors but it does not show python3-libnvinfer and python3-libnvinfer-dev which willbe installed through
sudo apt-get install python3-libnvinfer-dev
which returns me this error
$ sudo apt-get install python3-libnvinfer-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-libnvinfer-dev : Depends: python3-libnvinfer (= 7.2.2-1+cuda11.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
And installing this unmet dependency results in the error posted above, which says that I need python3(<3.7) and I have 3.8.2 installed in Ubuntu 20.04. Is it a problem with my operating system version or python version or tensorrt installation? I am not able to understand. Why am I not able to install python tensorrt api while my c++ tensorrt api is working fine. Need help!!!
Thank you
Hi @Himanshu01,
We recommend you trying NVIDIA GPU Cloud (NGC) tensorrt optimized containers, which removes many of the host-side dependencies.
https://ngc.nvidia.com/signin
Thank you
Hi .
python3-libnvinfer : Depends: python3 (< 3.7) but 3.8.2-0ubuntu2 is to be installed
My default python was 3.7 why this issue occurs
I have python3.6 installed via
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.6
I have changed the dependencies for python3-libnvinfer
as suggested in https://ubuntuforums.org/showthread.php?t=636724
via
apt download python3-libnvinfer=7.2.3-1+cuda11.1
DEBFILE="python3-libnvinfer_7.2.3-1+cuda11.1_amd64.deb"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modified.deb
dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN
CONTROL="$TMPDIR"/DEBIAN/control
sed -i 's/^Depends: python3 (>= 3.6), python3 (<< 3.7)/Depends: python3.6/g' $CONTROL
dpkg -b "$TMPDIR" "$OUTPUT"
rm -r "$TMPDIR"
sudo dpkg -i python3-libnvinfer_7.2.3-1+cuda11.1_amd64.modified.deb
sudo apt install python3-libnvinfer-dev=7.2.3-1+cuda11.1
You can do now:
$ python3.6
Python 3.6.13 (default, Feb 20 2021, 21:40:46)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorrt
>>>
2 Likes
I’ve met the same issue onto Ubuntu 20.04 with python 3.8.2
I had also tried docker images built on basis of NGC (nvcr.io/nvidia/tensorrt:21.03-py3, and 21.02) and that didn’t work for me: while nvidia-run the container it wrote “ERROR: No supported GPU(s) detected to run this container” at the start. The tensorrt didn’t work within the container (didn’t bind the device) but at the same time nvidia-smi worked fine.
So, I guess there is no stable build of TensorRT packages for Ubuntu 20.04 with python>3.7
1 Like
I also faced this issue. In my case, I had a source list (in /etc/apt/source.list
) pointing to Index of /compute/cuda/repos/ubuntu1804/x86_64 instead of Index of /compute/cuda/repos/ubuntu2004/x86_64