ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /.singularity.d/libs/libGLdispatch.so.0)

I created two apptainer containers. The first one has the installation of the Nvidia CUDA Toolkit 11.4.3 with conda. The second one has the installation of TensorRT and all the libraries needed for executing mmpose and mmdeploy code.

I have tried all the code in a PC with CUDA Toolkit 11.4.3, TensorRT 8.2.3.0 and cuDNN 8.2.1 and works fine. The problem is when I tried to put everything together in a Apptainer container as I am asked. I get the error ImportError: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.34' not found (required by /.singularity.d/libs/libGLdispatch.so.0) and the solutions I have found in internet doesn’t work for me. So I need help with this infrastructure aspect.

Versions:

  • apptainer: 1.2.5+403-g47a41fb43
  • SO
    Distributor ID: Pop
    Description: Pop!_OS 22.04 LTS
    Release: 22.04
    Codename: jammy

First container (nvidia_conda.def)

Bootstrap: docker
From: nvidia/cuda:11.4.3-devel-ubuntu18.04

%environment
    export PATH="/root/miniconda3/bin:$PATH"

%post
    rm /bin/sh && ln -s /bin/bash /bin/sh

    apt update
    apt install wget -y && rm -rf /var/lib/apt/lists/*

    mkdir -p ~/miniconda3
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
    rm -rf ~/miniconda3/miniconda.sh
    ~/miniconda3/bin/conda init bash

Second container (mmdeploy.def)

Bootstrap: localimage
From: nvidia_conda.sif

%environment
    export TENSORRT_DIR="/TensorRT-8.2.3.0"
    export LD_LIBRARY_PATH="${TENSORRT_DIR}/lib:$LD_LIBRARY_PATH"
    export CUDNN_DIR="/cuda"
    export LD_LIBRARY_PATH="$CUDNN_DIR/lib64:$LD_LIBRARY_PATH"

%files
    /media/icksir/Ricky/mmpose_container/cuda /cuda
    /media/icksir/Ricky/mmpose_container/TensorRT-8.2.3.0.Linux.x86_64-gnu.cuda-11.4.cudnn8.2/TensorRT-8.2.3.0 /TensorRT-8.2.3.0
    /home/icksir/Documentos/safetymind/mmdeploy /mmdeploy
    /home/icksir/Documentos/safetymind/inference_files /inference_files

%post
    apt update
    DEBIAN_FRONTEND=noninteractive apt-get install -y libgl1 libgl1-mesa-glx libglib2.0-0 
    rm -rf /var/lib/apt/lists/*

    conda create --name openmmlab python=3.8 -y
    conda run -n openmmlab conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
    conda run -n openmmlab pip install -U openmim
    conda run -n openmmlab mim install mmengine
    conda run -n openmmlab mim install "mmcv>=2.0.1"
    conda run -n openmmlab mim install "mmdet>=3.1.0"
    conda run -n openmmlab mim install "mmpose>=1.1.0"
    conda run -n openmmlab pip install mmdeploy==1.3.1
    conda run -n openmmlab pip install mmdeploy-runtime-gpu==1.3.1

    conda run -n openmmlab pip install /TensorRT-8.2.3.0/python/tensorrt-8.2.3.0-cp38-none-linux_x86_64.whl
    conda run -n openmmlab pip install pycuda

When I execute the code I needed I get

Traceback (most recent call last):
  File "inference_script.py", line 1, in <module>
    from mmdeploy.apis.utils import build_task_processor
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/apis/__init__.py", line 7, in <module>
    from .utils import build_task_processor, get_predefined_partition_cfg
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/apis/utils/__init__.py", line 3, in <module>
    from .utils import (build_task_processor, get_predefined_partition_cfg,
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/apis/utils/utils.py", line 7, in <module>
    from mmdeploy.codebase import BaseTask, get_codebase_class, import_codebase
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/codebase/__init__.py", line 5, in <module>
    from .base import BaseTask, MMCodebase, get_codebase_class
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/codebase/base/__init__.py", line 3, in <module>
    from .mmcodebase import CODEBASE, MMCodebase, get_codebase_class
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/codebase/base/mmcodebase.py", line 8, in <module>
    from .task import BaseTask
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmdeploy/codebase/base/task.py", line 7, in <module>
    import mmcv
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/__init__.py", line 4, in <module>
    from .image import *
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/image/__init__.py", line 2, in <module>
    from .colorspace import (bgr2gray, bgr2hls, bgr2hsv, bgr2rgb, bgr2ycbcr,
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/image/colorspace.py", line 4, in <module>
    import cv2
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/root/miniconda3/envs/openmmlab/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /.singularity.d/libs/libGLdispatch.so.0)

Please install opencv-python-headless

pip install opencv-python-headless