背景
由于最近需要使用paddleocr,因此需要安装依赖paddlepaddle-gpu,不管怎么安装cuda11.6-11.8安装了一遍,都无法正常安装成功。如下所示:
环境:wsl2+linux18.04
bash
>>> import paddle
>>> paddle.utils.run_check()
报错如下:
bash
PreconditionNotMetError: Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
[Hint: cudnn_dso_handle should not be null.] (at ../paddle/phi/backends/dynload/cudnn.cc:64)
[operator < fill_constant > error]
尝试
https://blog.csdn.net/qq451882471/article/details/106967942
https://blog.csdn.net/weixin_44065323/article/details/110082334
- 根据上面两位大佬的做法,无法解决;
- 怀疑是cuda和cudnn版本不一致,各种版本都试了一轮,也都无法解决;
docker
对paddle也是无语了,兼容性做的如此之差,谁还想继续使用下去(比torch、transformers库安装体验差多了),最后使用docker进行安装
https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/docker/linux-docker.html
- docker pull
bash
nvidia-docker pull registry.baidubce.com/paddlepaddle/paddle:2.5.2-gpu-cuda11.7-cudnn8.4-trt8.4
- docker run
bash
docker rundocker run --gpus=all --name docker_paddle -it -v /mnt:/mnt registry.baidub
ce.com/paddlepaddle/paddle:2.5.2-gpu-cuda11.7-cudnn8.4-trt8.4 /bin/bash --name paddle_docker -it -v /mnt:/mnt registry.baidubce.com/paddlepaddle/paddle:2.5.2-gpu-cuda11.7-cudnn8.4-trt8.4 /bin/bash
- 测试成功
bash
λ 9d35c036063b /home python
Python 3.7.14 (default, Sep 8 2022, 00:06:44)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I1104 10:41:01.608309 12 interpretercore.cc:237] New Executor is Running.
W1104 10:41:01.608773 12 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.9, Driver API Version: 12.3, Runtime API Version: 11.7
W1104 10:41:02.405509 12 gpu_resources.cc:149] device: 0, cuDNN Version: 8.4.
I1104 10:41:12.111374 12 interpreter_util.cc:518] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
>>>