前言:总结一下paddle-serving的安装过程,避免以后踩坑

环境:Ubuntu18.6  X86

1、安装docker

curl https://get.docker | sh \
    && sudo systemctl --now enable docker

2、安装nvidia-docker

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
   && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
   && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
    
apt-get update
apt-get install -y nvidia-docker2

3、验证nvidia-docker

docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

4、拉取paddle-serving的docker镜像,其他版本可以查看官网:https://github/PaddlePaddle/Serving/blob/v0.6.0/doc/DOCKER_IMAGES_CN.md

GPU镜像:

docker pull registry.baidubce/paddlepaddle/serving:0.7.0-cuda11.2-cudnn8-devel

CPU镜像:

docker pull registry.baidubce/paddlepaddle/serving:latest-devel

5、运行容器:

GPU容器:

docker run --name test -dit -p 9292:9292 --gpus 0 registry.baidubce/paddlepaddle/serving:0.7.0-cuda11.2-cudnn8-devel /bin/bash

注:我安装的是cuda11.2版本的镜像,后面装paddle-serving和paddlepaddle也是对应11.2的版本

CPU容器:

docker run --name test -dit -p 9292:9292 registry.baidubce/paddlepaddle/serving:latest-devel /bin/bash

注:此镜像中安装了python2.7|3.5|3.6|3.7|3.8版本,本人使用的是python3.7

6、安装依赖(清华源, 在pip命令中添加-i https://pypi.tuna.tsinghua.edu/simple ):

GPU环境:(这里我使用的是0.7.0的版本)

pip3.7 install paddle_serving_server_gpu==0.7.0.post112 paddle_serving_app==0.7.0 paddle_serving_client==0.7.0

CPU环境:(这里我使用的是最新版本)

pip3.7 install paddle-serving-app paddle-serving-server paddle-serving-client

其他依赖gpu和cpu通用:

git clone https://github/PaddlePaddle/Serving
cd Serving
pip3.7 install -r python/requirements.txt

注:我的项目使用的是paddleseg所以安装了下面的依赖,若不使用paddleseg可以跳过这一步
git clone https://github/PaddlePaddle/PaddleSeg.git
pip3.7 install -r requirements.txt

7、安装PaddlePaddle

官网:开始使用_飞桨-源于产业实践的开源深度学习平台飞桨PaddlePaddle快速安装使用方法,安装方式支持:pip,conda,docker,源码编译,选择操作系统快速安装实现您的AI想法.https://www.paddlepaddle/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html

python3.7 -m pip install paddlepaddle-gpu==2.3.2.post112 -f https://www.paddlepaddle/whl/linux/mkl/avx/stable.html

更多推荐

Paddle Serving的docker安装方法