installation_en.md 3.2 KB
Newer Older
X
xxxpsyduck 已提交
1
## QUICK INSTALLATION
K
Khanh Tran 已提交
2

fanruinet's avatar
fanruinet 已提交
3
After testing, PaddleOCR can run on glibc 2.23. You can also test other glibc versions or install glibc 2.23 for the best compatibility.
K
Khanh Tran 已提交
4 5

PaddleOCR working environment:
6
- PaddlePaddle 2.0.0
fanruinet's avatar
fanruinet 已提交
7
- Python 3.7
K
Khanh Tran 已提交
8
- glibc 2.23
G
grasswolfs 已提交
9

fanruinet's avatar
fanruinet 已提交
10
It is recommended to use the docker provided by us to run PaddleOCR. Please refer to the docker tutorial [link](https://www.runoob.com/docker/docker-tutorial.html/).
K
Khanh Tran 已提交
11

fanruinet's avatar
fanruinet 已提交
12
*If you want to directly run the prediction code on Mac or Windows, you can start from step 2.*
G
grasswolfs 已提交
13

fanruinet's avatar
fanruinet 已提交
14
**1. (Recommended) Prepare a docker environment. For the first time you use this docker image, it will be downloaded automatically. Please be patient.**
K
Khanh Tran 已提交
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

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

fanruinet's avatar
fanruinet 已提交
25
With CUDA10, please run the following command to create a container.
L
LDOUBLEV 已提交
26
It is recommended to set a shared memory greater than or equal to 32G through the --shm-size parameter:
K
Khanh Tran 已提交
27
```
L
LDOUBLEV 已提交
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
K
Khanh Tran 已提交
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
```

L
LDOUBLEV 已提交
36
**2. Install PaddlePaddle 2.0**
K
Khanh Tran 已提交
37 38 39
```
pip3 install --upgrade pip

W
WenmuZhou 已提交
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
G
grasswolfs 已提交
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
K
Khanh Tran 已提交
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.


M
MissPenguin 已提交
49
**3. Clone PaddleOCR repo**
K
Khanh Tran 已提交
50 51 52 53
```
# Recommend
git clone https://github.com/PaddlePaddle/PaddleOCR

fanruinet's avatar
fanruinet 已提交
54
# If you cannot pull successfully due to network problems, you can switch to the mirror hosted on Gitee:
K
Khanh Tran 已提交
55 56 57

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

fanruinet's avatar
fanruinet 已提交
58
# Note: The mirror on Gitee may not keep in synchronization with the latest update with the project on GitHub. There might be a delay of 3-5 days. Please try GitHub at first.
K
Khanh Tran 已提交
59 60
```

M
MissPenguin 已提交
61
**4. Install third-party libraries**
K
Khanh Tran 已提交
62 63
```
cd PaddleOCR
W
WenmuZhou 已提交
64
pip3 install -r requirements.txt
K
Khanh Tran 已提交
65
```
L
LDOUBLEV 已提交
66 67 68

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

fanruinet's avatar
fanruinet 已提交
69
Please try to download Shapely whl file from [http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely](http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely).
L
LDOUBLEV 已提交
70 71

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