0

I'm trying to install a specific version of NVIDIA's python3-libnvinfer (TensorRT) to a specific version of an AWS deep learning container.

Unfortunately, that image is based on Ubuntu 16.04 with Python 3.6 managed by Anaconda and apt has separately installed Python 3.5. When I try to apt-get install libnvinfer-plugin6=6.0.1-1+cuda10.1 it installs to the Python 3.5 environment vs the Python 3.6 environment I need to use.

root@beast:/app# python3 --version
Python 3.6.13 :: Anaconda, Inc.
root@beast:/app# which python
/opt/conda/bin/python
root@beast:/app# locate tensorrt | grep python
/usr/lib/python3.5/dist-packages/tensorrt

NVIDIA's pip install method only works with CUDA 11.3 but I'm pinned to CUDA 10.1 due to other dependencies and those dependencies will not work with Python 3.5:

The pip-installable nvidia-tensorrt Python wheel files only support Python versions
3.5 to 3.9 and CUDA 11.3 at this time and will not work with other Python or CUDA versions.

Is there any way to tell apt to install the package to the conda version of python (3.6) vs the apt version of python (3.5)?

Brad Dwyer
  • 6,305
  • 8
  • 48
  • 68
  • I don't think there is a sane way to satisfy this. As you have noticed, `apt` requires all dependencies to also be managed by `apt`. Similarly, there is no easy way to convince Conda that you have installed a paokage by other means with all the depencencies Conda expects to be satisfied; these different architectures also sometimes require conformant packages to implement additional behaviors, sometimes even to the point where compatibility with the upstream has to be sacrificed. – tripleee Aug 23 '21 at 17:14
  • There are hacks like `equivs` which let you convince Apt that a package is in fact installed, but it is only really suitable for quick and dirty fixes, not for building a complex and robust alternative solution. – tripleee Aug 23 '21 at 17:15
  • 1
    Having said that, it might be feasible to compile and package your own `.deb` for version 3.6 of Python based on the source package for 3.5. – tripleee Aug 23 '21 at 17:17
  • It looks like the "build from source" option actually builds a pip wheel, not the `.deb`. I know pip works to install dependencies to the right python in this image so I'm going to try that route next. – Brad Dwyer Aug 23 '21 at 17:21
  • 1
    You probably misunderstood what I tried to say. You would download the package source with `apt-get source packagename` and then edit the scripts to package a different version with your own dependencies. – tripleee Aug 23 '21 at 17:24
  • @tripleee could you give more details on the steps after `apt-get source packagename` necessary to install `packagename` into a conda environment? – Homero Esmeraldo May 20 '22 at 03:01
  • See https://stackoverflow.com/questions/130894/how-to-build-a-debian-ubuntu-package-from-source for how to build from source. You are then free to install that package anywhere; I'm not particularly familiar with Conda, but this bypasses that anyway. – tripleee May 20 '22 at 03:04

0 Answers0