Teach you how to install PaddleDetection (latest CUDA11.7 version)

foreword

This article records the process of installing PaddleDetection in the linux system, using Conda to install it;

(I tried the docker method, but I couldn’t get the image; I tried the pip method, but I couldn’t find the library; I finally installed it successfully using Conda.)

Table of contents

foreword

1. Set the domestic source to accelerate Conda

2. Create a Conda environment

3. Install PaddlePaddle

4. Install Paddle Detection


1. Set the domestic source to accelerate Conda

In the Linux system, configure the source of conda by modifying the condarc file

vim ~/.condarc

 Change it to look like this:

show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

2. Create a Conda environment

Create a Conda environment named PaddleDetection and specify python version 3.8

conda create -n PaddleDetection python=3.8

enter the environment

conda activate PaddleDetection

3. Install PaddlePaddle

First come to the official website, choose the appropriate CUDA version, I chose the latest CUDA11.7

https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/conda/linux-conda.html

 Install according to the installation information (command) in the above figure;

conda install paddlepaddle-gpu==2.4.2 cudatoolkit=11.7 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ -c conda-forge

Then configure the environment variable (if not configured, the following error will occur when using it)

dynamic_loader.cc:307] The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly. (error code is /usr/local/cuda/lib64/libcudnn.so: cannot open shared object file: No such file or directory)

Use conda env list to query the path of the environment

(PaddleDetection) root@bap3ac2457:/guopu # conda env list

# conda environments:
#
base                     /opt/conda
PaddleDetection       *  /opt/conda/envs/PaddleDetection

You can see that the path of the newly created Conda is  /opt/conda/envs/PaddleDetection

Add /opt/conda/envs/PaddleDetection/lib/ to environment variables.bashrc

echo "export LD_LIBRARY_PATH=/opt/conda/envs/PaddleDetection/lib/">>~/.bashrc

Test whether the installation is successful

# 确认PaddlePaddle安装成功
python -c "import paddle; paddle.utils.run_check()"

# 确认PaddlePaddle版本
python -c "import paddle; print(paddle.__version__)"

See the successful print message

(PaddleDetection) root@bap3ac2457:/guopu# python -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ... 
W0508 08:48:03.937019 44515 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.8, Runtime API Version: 11.7
W0508 08:48:03.950474 44515 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
PaddlePaddle works well on 1 GPU.
PaddlePaddle works well on 1 GPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

(PaddleDetection) root@bap3ac2457:/guopu# 

4. Install Paddle Detection

First download the PaddleDetection code

git clone https://github.com/PaddlePaddle/PaddleDetection.git

Enter the project directory

cd PaddleDetection

Use pip to install dependencies, you can use -i https://pypi.tuna.tsinghua.edu.cn/simple to speed up installation

pip install -r requirements.txt

If an error is reported when installing pycocotools, refer to https://blog.csdn.net/weixin_57096837/article/details/122775990

Compile and install paddlelet

python setup.py install

If there is an error downloading some libraries, such as pyclipper, then manually install: pip install pyperclip, and then execute python setup.py install

If error: protobuf 3.20.0 is installed but protobuf>=3.20.2 is required by {'onnx'}, execute: pip install protobuf==3.20.3

test environment

Confirm that the test passes after installation:

python ppdet/modeling/tests/test_architectures.py

After the test is passed, the following information will be displayed:

(PaddleDetection) root@bap3ac2457:/guopu/PaddleDetection# python ppdet/modeling/tests/test_architectures.py
Warning: Unable to use numba in PP-Tracking, please install numba, for example(python3.7): `pip install numba==0.56.4`
Warning: Unable to use numba in PP-Tracking, please install numba, for example(python3.7): `pip install numba==0.56.4`
W0510 00:52:22.579213 47617 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.8, Runtime API Version: 11.7
W0510 00:52:22.590267 47617 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4.
.......
----------------------------------------------------------------------
Ran 7 tests in 3.731s

OK
(PaddleDetection) root@bap3ac2457:/guopu/PaddleDetection# 

If the above information is printed, the installation is complete~

Guess you like

Origin blog.csdn.net/qq_41204464/article/details/130562590