PyTorch and GLIBC compatibility error after upgrading JetPack to 4.5

A few days ago we upgraded JetPack to v4.5 on our Xavier Ubuntu 18.04 aarch64 machine. After installing PyTorch v1.7.0 with torchvision v8.1.0 I receive the following error when running import torch in Python v3.6.9

ImportError: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /home/venv/lib/python3.6/site-packages/torch/lib/libtorch_python.so)

Currently there is GLIBC v2.27 installed.

Do you know how can I solve this problem? I read online that upgrading GLIBC is not my best option as this requires a lot of effort and some risk as may other aprty of my system depend on GLIBC v2.27 .

Hi @janickspirig10, I just checked a Jetson running JetPack 4.5 (L4T R32.5.0) and JetPack 4.4.1 (L4T R32.4.4) and they both reported to be using GLIBC v2.27. I checked it with this command:

ldd --version ldd

So I’m not sure where the dependency on GLIBC v2.28 is coming from, as those PyTorch wheels were built on these versions of JetPack with GLIBC v2.27.

Did you install the PyTorch wheel from this thread? https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-8-0-now-available/72048

The only difference I see is that you appear to be using virtualenv, I wonder if that is somehow related (or upgraded pip/pip3 version). Are you able to import torch in the l4t-pytorch container?

Hi @dusty_nv
Thank you very much for your feedback.
Yes, JetPack 4.5 on our Jetson is also using GLIBC v2.27 and it is also for me a secret where this dependency with GLIBC v2.28 is coming from.

Using the wheels under the link provided did not work for me / I still get the same error message.

Is maybe something wit the JetPack installation wrong?

NVIDIA Jetson AGX Xavier [16GB]
 L4T 32.5.1 [ JetPack UNKNOWN ]
   Ubuntu 18.04.5 LTS
   Kernel Version: 4.9.201-tegra
 CUDA 10.2.89
   CUDA Architecture: 7.2
 OpenCV version: 4.1.1
   OpenCV Cuda: NO
 CUDNN: 8.0.0.180
 TensorRT: 7.1.3.0
 Vision Works: 1.6.0.501
 VPI: ii libnvvpi1 1.0.15 arm64 NVIDIA Vision Programming Interface library

Because it says “JetPack UNKNOWN”.

Thank you.

I think that may just be the jetson-stats tool needing update. You should instead be able to run cat /etc/nv_tegra_release. It looks like you are on L4T R32.5.1 / JetPack 4.5.1

My recommendation is to try the l4t-pytorch container. You can use the r32.5.0 containers on r32.5.1:

Are you able to run those?

If you don’t want to use container, my suggestion would be to re-flash your Jetson with SDK Manager. I wonder if something happened during your apt-upgrade from previous JetPack version.

Hi @dusty_nv

Thanks a lot. With the docker container it is working like charm.

Just one additional question.
How can I save this docker image locally? Because additionally to pytorch I need to install some other dependencies and it would be messy if I have to reinstall the dependencies every time from scratch after launching the container.

Many thanks
Janick

My recommendation is to make your own Dockerfile with FROM nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.7-py3 at the top. Then put your RUN commands in there to install packages, like so:

FROM nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.7-py3

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
          some-apt-package-here \
          another-apt-package-here \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

RUN pip3 install some-pip-package --verbose

Then you can build your Dockerfile with:

sudo docker build -t my-pytorch-container:latest -f Dockerfile

Then run the my-pytorch-container:latest tag instead.