Skip to content

PaddleX Local Installation Tutorial

❗Before installing PaddleX, please ensure you have a basic Python environment (Note: Currently supports Python 3.8 to Python 3.12, with more Python versions being adapted).

1. Quick Installation

Welcome to PaddleX, Baidu's low-code development tool for AI. Before we dive into the local installation process, please clarify your development needs and choose the appropriate installation mode.

PaddleX offers two installation modes: Wheel Package Installation and Plugin Installation. Below, we introduce their respective application scenarios:

1.1 Wheel Package Installation Mode

If your use case for PaddleX involves model inference and integration, we recommend the more convenient and lightweight Wheel package installation mode.

After installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the PaddleX Wheel package by executing the following commands:

Note: Please ensure that PaddlePaddle is successfully installed before proceeding to the next step.

# Only install the required dependencies (optional dependencies can be installed later as needed)
pip install paddlex==3.0.0rc1

You can install the optional dependencies as needed using the following method (For more details, please refer to 2.3 Selective Installation of Dependencies):

Install all dependencies required for PaddleX "basic features":

pip install "paddlex[base]==3.0.0rc1"

Only install the dependencies required for a specific feature:

pip install "paddlex[ocr]==3.0.0rc1"

1.2 Plugin Installation Mode

If your use case for PaddleX involves custom development (e.g. retraining models, fine-tuning models, customizing model structures, customizing inference codes, etc.), we recommend the more powerful plugin installation mode.

After installing the PaddleX plugins you need, you can not only perform inference and integration with the supported models but also conduct advanced operations such as model training for custom development.

The model training related plugins supported by PaddleX are listed below. Please determine the name(s) of the plugin(s) you need based on your development requirements:

👉 Plugin and Pipeline Correspondence (Click to Expand)
Pipeline Module Corresponding Plugin
General Image Classification Image Classification PaddleClas
General Object Detection Object Detection PaddleDetection
General Semantic Segmentation Semantic Segmentation PaddleSeg
General Instance Segmentation Instance Segmentation PaddleDetection
General OCR Text Detection
Text Recognition
PaddleOCR
Table Recognition Layout Region Detection
Table Structure Recognition
Text Detection
Text Recognition
PaddleOCR
PaddleDetection
PP-ChatOCRv3-doc Table Structure Recognition
Layout Region Detection
Text Detection
Text Recognition
Seal Text Detection
Text Image Correction
Document Image Orientation Classification
PaddleOCR
PaddleDetection
PaddleClas
Time Series Forecasting Time Series Forecasting Module PaddleTS
Time Series Anomaly Detection Time Series Anomaly Detection Module PaddleTS
Time Series Classification Time Series Classification Module PaddleTS
Image Multi-Label Classification Image Multi-label Classification PaddleClas
Small Object Detection Small Object Detection PaddleDetection
Image Anomaly Detection Unsupervised Anomaly Detection PaddleSeg

If the plugin you need to install is PaddleXXX, after installing PaddlePaddle (refer to the PaddlePaddle Local Installation Tutorial), you can quickly install the corresponding PaddleX plugin by executing the following commands:

git clone https://github.com/PaddlePaddle/PaddleX.git
cd PaddleX
pip install -e ".[base]"
paddlex --install PaddleXXX

❗ Note: The two installation methods are not mutually exclusive, and you can install both simultaneously.

Next, we provide detailed installation tutorials for your reference. If you are using a Linux operating system, please refer to 2. Detailed Tutorial for Installing PaddleX on Linux.

2. Detailed Tutorial for Installing PaddleX on Linux

When installing PaddleX on Linux, we strongly recommend using the official PaddleX Docker image. Alternatively, you can use other custom installation methods.

When using the official Docker image, PaddlePaddle, PaddleX (including the wheel package and all plugins), and the corresponding CUDA environment are already pre-installed. You can simply obtain the Docker image and start the container to begin using it. Please note that the official Docker image of PaddleX is different from the official Docker image of the PaddlePaddle framework, as the latter does not come with PaddleX pre-installed.

When using custom installation methods, you need to first install the PaddlePaddle framework, then obtain the PaddleX source code, and finally choose the PaddleX installation mode.

2.1 Get PaddleX based on Docker

Using the PaddleX official Docker image, create a container called 'paddlex' and map the current working directory to the '/paddle' directory inside the container by following the command.

If your Docker version >= 19.03, please use:

# For CPU
docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0rc1-paddlepaddle3.0.0-cpu /bin/bash

# gpu,requires GPU driver version ≥450.80.02 (Linux) or ≥452.39 (Windows)
docker run --gpus all --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0rc1-paddlepaddle3.0.0-gpu-cuda11.8-cudnn8.9-trt8.6 /bin/bash
  • If your Docker version <= 19.03 and >= 17.06, please use:
Click Here
# For CPU
docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0rc1-paddlepaddle3.0.0-cpu /bin/bash

# For GPU
# gpu,requires GPU driver version ≥450.80.02 (Linux) or ≥452.39 (Windows)
nvidia-docker run --name paddlex -v $PWD:/paddle --shm-size=8g --network=host -it ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.0rc1-paddlepaddle3.0.0-gpu-cuda11.8-cudnn8.9-trt8.6 /bin/bash

  • If your Docker version <= 17.06, please update your Docker.

  • If you want to delve deeper into the principles or usage of Docker, please refer to the Docker Official Website or the Docker Official Tutorial. Support for CUDA 12 and above is currently in progress. Stay tuned.

2.2 Custom Installation of PaddleX

Before installation, please ensure you have completed the local installation of PaddlePaddle by referring to the PaddlePaddle Local Installation Tutorial.

2.2.1 Obtain PaddleX Source Code

Next, use the following command to obtain the latest PaddleX source code from GitHub:

git clone https://github.com/PaddlePaddle/PaddleX.git
If accessing GitHub is slow, you can download from Gitee instead, using the following command:

git clone https://gitee.com/paddlepaddle/PaddleX.git

2.2.2 Install PaddleX

After obtaining the latest PaddleX source code, you can choose between Wheel package installation mode or plugin installation mode.

  • If you choose Wheel package installation mode, execute the following commands:
cd PaddleX

# Install PaddleX whl
# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel
pip install -e ".[base]"
  • If you choose plugin installation mode and the plugin you need is named PaddleXXX (there can be multiple), execute the following commands:
cd PaddleX

# Install PaddleX whl
# -e: Install in editable mode, so changes to the current project's code will directly affect the installed PaddleX Wheel
pip install -e ".[base]"

# Install PaddleX plugins
paddlex --install PaddleXXX

For example, if you need to install the PaddleOCR and PaddleClas plugins, execute the following commands to install the plugins:

# Install PaddleOCR and PaddleClas plugins
paddlex --install PaddleOCR PaddleClas

If you need to install all plugins, you do not need to specify the plugin names, just execute the following command:

# Install all PaddleX plugins
paddlex --install

The default clone source for plugins is github.com, but it also supports gitee.com as a clone source. You can specify the clone source using --platform.

For example, if you need to use gitee.com as the clone source to install all PaddleX plugins, just execute the following command:

# Install PaddleX plugins
paddlex --install --platform gitee.com

After installation, you will see the following prompt:

All packages are installed.

For PaddleX installation on more hardware environments, please refer to the PaddleX Multi-hardware Usage Guide

2.3 Selective Installation of Dependencies

PaddleX offers a wide range of features, and different features require different dependencies. The features in PaddleX that can be used without installing plugins are categorized as "basic features." The official PaddleX Docker images have all dependencies required for these basic features preinstalled. Similarly, using the installation method introduced earlier—pip install "...[base]"—will install all dependencies needed for the basic features.

If you are only focused on a specific feature of PaddleX and want to minimize the size of the installed dependencies, you can selectively install them by specifying a "dependency group":

# For example, to install only the basic OCR features

# Install the precompiled wheel package
pip install "paddlex[ocr]"
# Install from source
pip install -e ".[ocr]"

# You can also specify multiple dependency groups at once
pip install -e ".[ocr,cv]"

PaddleX currently provides the following dependency groups:

Dependency Group Corresponding Features
base All basic features of PaddleX.
cv Basic features of computer vision pipelines.
multimodal Basic features of multimodal pipelines.
ie Basic features of information extraction pipelines.
ocr Basic features of OCR-related pipelines.
speech Basic features of speech pipeline.s
ts Basic features of time series pipelines.
video Basic features of video pipelines.
serving The serving feature. Installing this group is equivalent to installing the PaddleX serving plugin; the plugin can also be installed via the PaddleX CLI.
plugins All plugin-provided features that support installation via dependency groups.
all All basic features of PaddleX, as well as all plugin-provided features installable via dependency groups.

Each pipeline belongs to exactly one dependency group. You can refer to the tutorial of each pipeline to find out which dependency group it belongs to. For modules, you can access the related basic features by installing any dependency group that includes the module.

Comments