installation_en.md 3.27 KB
Newer Older
xxxpsyduck's avatar
xxxpsyduck committed
1
## QUICK INSTALLATION
Khanh Tran's avatar
Khanh Tran committed
2
3
4
5

After testing, paddleocr can run on glibc 2.23. You can also test other glibc versions or install glic 2.23 for the best compatibility.

PaddleOCR working environment:
6
- PaddlePaddle 2.0.0
dyning's avatar
dyning committed
7
- python3.7
Khanh Tran's avatar
Khanh Tran committed
8
- glibc 2.23
grasswolfs's avatar
grasswolfs committed
9

WenmuZhou's avatar
WenmuZhou committed
10
It is recommended to use the docker provided by us to run PaddleOCR, please refer to the use of docker [link](https://www.runoob.com/docker/docker-tutorial.html/).
Khanh Tran's avatar
Khanh Tran committed
11

grasswolfs's avatar
grasswolfs committed
12
13
*If you want to directly run the prediction code on mac or windows, you can start from step 2.*

LDOUBLEV's avatar
LDOUBLEV committed
14
**1. (Recommended) Prepare a docker environment. The first time you use this docker image, it will be downloaded automatically. Please be patient.**
Khanh Tran's avatar
Khanh Tran committed
15
16
17
18
19
20
```
# Switch to the working directory
cd /home/Projects
# You need to create a docker container for the first run, and do not need to run the current command when you run it again
# Create a docker container named ppocr and map the current directory to the /paddle directory of the container

LDOUBLEV's avatar
LDOUBLEV committed
21
#If using CPU, use docker instead of nvidia-docker to create docker
LDOUBLEV's avatar
LDOUBLEV committed
22
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it  paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82  /bin/bash
Khanh Tran's avatar
Khanh Tran committed
23
```
LDOUBLEV's avatar
LDOUBLEV committed
24
25
26

If using CUDA10, please run the following command to create a container.
It is recommended to set a shared memory greater than or equal to 32G through the --shm-size parameter:
Khanh Tran's avatar
Khanh Tran committed
27
```
LDOUBLEV's avatar
LDOUBLEV committed
28
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash
Khanh Tran's avatar
Khanh Tran committed
29
30
31
32
33
34
35
```
You can also visit [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that fits your machine.
```
# ctrl+P+Q to exit docker, to re-enter docker using the following command:
sudo docker container exec -it ppocr /bin/bash
```

WenmuZhou's avatar
WenmuZhou committed
36
**2. Install PaddlePaddle Fluid v2.0**
Khanh Tran's avatar
Khanh Tran committed
37
38
39
```
pip3 install --upgrade pip

WenmuZhou's avatar
WenmuZhou committed
40
# If you have cuda9 or cuda10 installed on your machine, please run the following command to install
41
python3 -m pip install paddlepaddle-gpu==2.0.0 -i https://mirror.baidu.com/pypi/simple
grasswolfs's avatar
grasswolfs committed
42
43

# If you only have cpu on your machine, please run the following command to install
44
python3 -m pip install paddlepaddle==2.0.0 -i https://mirror.baidu.com/pypi/simple
Khanh Tran's avatar
Khanh Tran committed
45
46
47
48
```
For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation.


MissPenguin's avatar
MissPenguin committed
49
**3. Clone PaddleOCR repo**
Khanh Tran's avatar
Khanh Tran committed
50
51
52
53
54
55
56
57
58
59
60
```
# Recommend
git clone https://github.com/PaddlePaddle/PaddleOCR

# If you cannot pull successfully due to network problems, you can also choose to use the code hosting on the cloud:

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

# Note: The cloud-hosting code may not be able to synchronize the update with this GitHub project in real time. There might be a delay of 3-5 days. Please give priority to the recommended method.
```

MissPenguin's avatar
MissPenguin committed
61
**4. Install third-party libraries**
Khanh Tran's avatar
Khanh Tran committed
62
63
```
cd PaddleOCR
WenmuZhou's avatar
WenmuZhou committed
64
pip3 install -r requirements.txt
Khanh Tran's avatar
Khanh Tran committed
65
```
66
67
68
69
70
71

If you getting this error `OSError: [WinError 126] The specified module could not be found` when you install shapely on windows.

Please try to download Shapely whl file using [http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely](http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely).

Reference: [Solve shapely installation on windows](https://stackoverflow.com/questions/44398265/install-shapely-oserror-winerror-126-the-specified-module-could-not-be-found)