Install_EN.md 7.5 KB
Newer Older
T
TeslaZhao 已提交
1 2
# Install Paddle Serving with Docker

H
huangjianhui 已提交
3
([简体中文](./Install_CN.md)|English)
T
TeslaZhao 已提交
4

B
bjjwwang 已提交
5
**Strongly recommend** you build **Paddle Serving** in Docker. For more images, please refer to [Docker Image List](Docker_Images_CN.md).
T
TeslaZhao 已提交
6

T
TeslaZhao 已提交
7
**Tip-1**: This project only supports <mark>**Python3.6/3.7/3.8/3.9**</mark>, all subsequent operations related to Python/Pip need to select the correct Python version.
T
TeslaZhao 已提交
8

B
bjjwwang 已提交
9
**Tip-2**: The GPU environments in the following examples are all cuda10.2-cudnn7. If you use Python Pipeline to deploy and need Nvidia TensorRT to optimize prediction performance, please refer to [Supported Mirroring Environment and Instructions](#4.-Supported-Docker-Images-and-Instruction) to choose other versions.
T
TeslaZhao 已提交
10

B
bjjwwang 已提交
11
## 1. Start the Docker Container
T
TeslaZhao 已提交
12
<mark>**Both Serving Dev Image and Paddle Dev Image are supported at the same time. You can choose 1 from the operation 2 in chapters 1.1 and 1.2.**</mark>Deploying the Serving service on the Paddle docker image requires the installation of additional dependency libraries. Therefore, we directly use the Serving development image.
B
bjjwwang 已提交
13 14 15

### 1.1 Serving Dev Images (CPU/GPU 2 choose 1)
**CPU:**
T
TeslaZhao 已提交
16
```
B
bjjwwang 已提交
17
# Start CPU Docker Container
T
TeslaZhao 已提交
18 19
docker pull paddlepaddle/serving:0.8.0-devel
docker run -p 9292:9292 --name test -dit paddlepaddle/serving:0.8.0-devel bash
T
TeslaZhao 已提交
20 21 22
docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
B
bjjwwang 已提交
23
**GPU:**
T
TeslaZhao 已提交
24
```
B
bjjwwang 已提交
25
# Start GPU Docker Container
T
TeslaZhao 已提交
26 27
docker pull paddlepaddle/serving:0.8.0-cuda10.2-cudnn7-devel
nvidia-docker run -p 9292:9292 --name test -dit paddlepaddle/serving:0.8.0-cuda10.2-cudnn7-devel bash
T
TeslaZhao 已提交
28 29 30
nvidia-docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
B
bjjwwang 已提交
31 32
### 1.2 Paddle Dev Images (choose any codeblock of CPU/GPU)
**CPU:**
T
TeslaZhao 已提交
33
```
B
bjjwwang 已提交
34
# Start CPU Docker Container
T
TeslaZhao 已提交
35 36
docker pull paddlepaddle/paddle:2.2.2
docker run -p 9292:9292 --name test -dit paddlepaddle/paddle:2.2.2 bash
B
bjjwwang 已提交
37 38
docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
T
TeslaZhao 已提交
39

B
bjjwwang 已提交
40 41 42 43 44 45
# Paddle dev image needs to run the following script to increase the dependencies required by Serving
bash Serving/tools/paddle_env_install.sh
```
**GPU:**
```
# Start GPU Docker
T
TeslaZhao 已提交
46 47
docker pull paddlepaddle/paddle:2.2.2-gpu-cuda10.2-cudnn7
nvidia-docker run -p 9292:9292 --name test -dit paddlepaddle/paddle:2.2.2-gpu-cuda10.2-cudnn7 bash
B
bjjwwang 已提交
48 49
nvidia-docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
T
TeslaZhao 已提交
50

B
bjjwwang 已提交
51 52 53
# Paddle development image needs to execute the following script to increase the dependencies required by Serving
bash Serving/tools/paddle_env_install.sh
```
T
TeslaZhao 已提交
54

T
TeslaZhao 已提交
55
## 2. Install Paddle Serving stable wheel packages
T
TeslaZhao 已提交
56

B
bjjwwang 已提交
57 58 59 60 61
Install the required pip dependencies
```
cd Serving
pip3 install -r python/requirements.txt
```
T
TeslaZhao 已提交
62

T
TeslaZhao 已提交
63 64
Install the service whl package. There are three types of client, app and server. The server is divided into CPU and GPU. Choose one installation according to the environment. 
- GPU with CUDA10.2 + Cudnn7 + TensorRT6(Recommended)
B
bjjwwang 已提交
65
```shell
T
TeslaZhao 已提交
66 67
pip3 install paddle-serving-client==0.8.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install paddle-serving-app==0.8.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
T
TeslaZhao 已提交
68 69

# CPU Server
T
TeslaZhao 已提交
70
pip3 install paddle-serving-server==0.8.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
T
TeslaZhao 已提交
71 72

# GPU environments need to confirm the environment before choosing which one to execute
T
TeslaZhao 已提交
73 74 75
pip3 install paddle-serving-server-gpu==0.8.2.post102 -i https://pypi.tuna.tsinghua.edu.cn/simple 
pip3 install paddle-serving-server-gpu==0.8.2.post101 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install paddle-serving-server-gpu==0.8.2.post112 -i https://pypi.tuna.tsinghua.edu.cn/simple
B
bjjwwang 已提交
76
```
T
TeslaZhao 已提交
77

T
TeslaZhao 已提交
78
By default, the domestic Tsinghua mirror source is turned on to speed up the download. If you use a proxy, you can turn it off(`-i https://pypi.tuna.tsinghua.edu.cn/simple`).
T
TeslaZhao 已提交
79

B
bjjwwang 已提交
80
If you need to use the installation package compiled by the develop branch, please download the download address from [Latest installation package list](./Latest_Packages_CN.md), and use the `pip install` command to install. If you want to compile by yourself, please refer to [Paddle Serving Compilation Document](./Compile_CN.md).
T
TeslaZhao 已提交
81

B
bjjwwang 已提交
82
The paddle-serving-server and paddle-serving-server-gpu installation packages support Centos 6/7, Ubuntu 16/18 and Windows 10.
T
TeslaZhao 已提交
83

T
TeslaZhao 已提交
84
The paddle-serving-client and paddle-serving-app installation packages support Linux and Windows, and paddle-serving-client only supports python3.6/3.7/3.8/3.9.
T
TeslaZhao 已提交
85

T
TeslaZhao 已提交
86
**If you used the CUDA10.2 environment of paddle serving 0.5.X 0.6.X before, you need to pay attention to version 0.8.0, paddle-serving-server-gpu==0.8.0.post102 uses Cudnn7 and TensorRT6, and 0.6.0.post102 uses cudnn8 and TensorRT7. If 0.6.0 cuda10.2 users need to upgrade, please use paddle-serving-server-gpu==0.8.0.post1028**
J
Jiawei Wang 已提交
87

B
bjjwwang 已提交
88 89
## 3. Install Paddle related Python libraries
**You only need to install it when you use the `paddle_serving_client.convert` command or the `Python Pipeline framework`. **
T
TeslaZhao 已提交
90
```
B
bjjwwang 已提交
91
# CPU environment please execute
T
TeslaZhao 已提交
92
pip3 install paddlepaddle==2.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
T
TeslaZhao 已提交
93

T
TeslaZhao 已提交
94
# GPU CUDA 10.2 environment please execute
T
TeslaZhao 已提交
95
pip3 install paddlepaddle-gpu==2.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
T
TeslaZhao 已提交
96
```
T
TeslaZhao 已提交
97
**Note**: If your CUDA version is not 10.2 or if you want to use TensorRT(CUDA10.2 included), please do not execute the above commands directly, you need to refer to [Paddle-Inference official document-download and install the Linux prediction library](https://paddleinference.paddlepaddle.org.cn/master/user_guides/download_lib.html#python) Select the URL link of the corresponding GPU environment and install it. Assuming that you use Python3.6, please follow the codeblock.
T
TeslaZhao 已提交
98 99

```
T
TeslaZhao 已提交
100 101
# CUDA10.1 + CUDNN7 + TensorRT6
pip3 install https://paddle-inference-lib.bj.bcebos.com/2.2.2/python/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddlepaddle_gpu-2.2.2.post101-cp36-cp36m-linux_x86_64.whl
102

T
TeslaZhao 已提交
103 104
# CUDA10.2 + CUDNN7 + TensorRT6, Attenton that the paddle whl for this env is same to that of CUDA10.1 + Cudnn7 + TensorRT6
pip3 install https://paddle-inference-lib.bj.bcebos.com/2.2.2/python/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.1_cudnn7.6.5_trt6.0.1.5/paddlepaddle_gpu-2.2.2.post101-cp36-cp36m-linux_x86_64.whl
105

T
TeslaZhao 已提交
106 107
# CUDA10.2 + Cudnn8 + TensorRT7
pip3 install https://paddle-inference-lib.bj.bcebos.com/2.2.2/python/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda10.2_cudnn8.1.1_trt7.2.3.4/paddlepaddle_gpu-2.2.2-cp36-cp36m-linux_x86_64.whl
108

T
TeslaZhao 已提交
109 110
# CUDA11.2 + CUDNN8 + TensorRT8
pip3 install https://paddle-inference-lib.bj.bcebos.com/2.2.2/python/Linux/GPU/x86-64_gcc8.2_avx_mkl_cuda11.2_cudnn8.2.1_trt8.0.3.4/paddlepaddle_gpu-2.2.2.post112-cp36-cp36m-linux_x86_64.whl
T
TeslaZhao 已提交
111
```
112

B
bjjwwang 已提交
113
## 4. Supported Docker Images and Instruction
T
TeslaZhao 已提交
114 115


B
bjjwwang 已提交
116 117
| Environment | Serving Development Image Tag | Operating System | Paddle Development Image Tag | Operating System |
| :--------------------------: | :-------------------------------: | :-------------: | :-------------------: | :----------------: |
T
TeslaZhao 已提交
118 119 120 121 122
|  CPU                         | 0.8.0-devel                       |  Ubuntu 16.04   | 2.2.2                 | Ubuntu 18.04.       |
|  CUDA10.1 + CUDNN7             | 0.8.0-cuda10.1-cudnn7-devel       |  Ubuntu 16.04   | 无                     | 无                 |
|  CUDA10.2 + CUDNN7             | 0.8.0-cuda10.2-cudnn7-devel       |  Ubuntu 16.04   | 2.2.2-gpu-cuda10.2-cudnn7 | Ubuntu 16.04        |
|  CUDA10.2 + CUDNN8             | 0.8.0-cuda10.2-cudnn8-devel       |  Ubuntu 16.04   | 无                    |  无                 |
|  CUDA11.2 + CUDNN8             | 0.8.0-cuda11.2-cudnn8-devel       |  Ubuntu 16.04   | 2.2.2-gpu-cuda11.2-cudnn8 | Ubuntu 18.04        | 
T
TeslaZhao 已提交
123

B
bjjwwang 已提交
124
For **Windows 10 users**, please refer to the document [Paddle Serving Guide for Windows Platform](Windows_Tutorial_CN.md).