I am currently working on an OCR task using PaddleOCR within a Docker container. I am encountering the following error when trying to execute my application:
RuntimeError: (PreconditionNotMet) Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
[Hint: cudnn_dso_handle should not be null.] (at /paddle/paddle/phi/backends/dynload/cudnn.cc:64)
Here are the details of my setup:
-
Docker Image:
python:3.10-slim
-
PaddleOCR Version: 2.8.1
-
Paddlepaddle-gpu Version: 2.6.1
-
Host System: Ubuntu – 22.04.2
Here’s my Dockerfile:
FROM python:3.10-slim
ENV HOME /app
WORKDIR /app
COPY . /app
RUN apt-get update && apt-get install -y
build-essential
cmake
poppler-utils
ffmpeg
libsm6
libxext6
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /app/.cache/paddle && chmod -R 777 /app
# Setting environment variables
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
Error Details
- Error Message:
RuntimeError: (PreconditionNotMet) Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.[Hint: cudnn_dso_handle should not be null.] (at /paddle/paddle/phi/backends/dynload/cudnn.cc:64)
Any guidance or suggestions on how to resolve this issue would be greatly appreciated!
What I’ve Tried
- Setting Environment Variables: Added
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
to the Dockerfile.
Questions:
-
What additional steps can I take to ensure that cuDNN is properly installed and accessible within the Docker container?
-
Are there specific Docker images recommended for using PaddleOCR with GPU support?
-
Could there be any other configuration issues that might be causing this problem?
Any guidance or suggestions on how to resolve this issue would be greatly appreciated!