In the TensorRT L4T docker image, the default python version is 3.8, but apt aliases like
python3-dev install 3.6 versions (so package building is broken) and any
python-foo packages aren’t found by python. For some packages like
python-opencv building from sources takes prohibitively long on Tegra, so software that relies on it and TensorRT can’t work, at least with the default python3 version.
root@ab4490a9c568:/app# apt-get install python3-opencv Reading package lists... Done Building dependency tree Reading state information... Done python3-opencv is already the newest version (3.2.0+dfsg-4ubuntu0.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@ab4490a9c568:/app# python3 Python 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'cv2'
Also, looks like a manual symlink was made from python3.8 to python3 instead of using
update-alternatives. You can set it like this instead (for 3.6):
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in auto mode
That way the package manager knows what the default Python version is. Still won’t provide missing
python-foo packages, but it’s a start.
It would be nice if TensorRT images worked the same on Tegra and x86. Unfortunately this can’t be relied on. Every time I have to port a
Dockerfile to Tegra it’s at least a day of
if tegra... workarounds leading to build scripts and
--build-arg=blabla when ideally the same
Dockerfile should just work on any platform, as is the case with images derived from
ubuntu:latest. It would be really nice to just
docker-compose up and have everything just work as there is nothing technically prohibiting this.