From b0b3dd91b3b8e256207f67e079067b6b4965631e Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Tue, 12 Oct 2021 19:15:18 +0800 Subject: [PATCH] update docker --- doc/doc_ch/environment.md | 45 ++++----------------------------- doc/doc_en/environment_en.md | 48 +++--------------------------------- 2 files changed, 8 insertions(+), 85 deletions(-) diff --git a/doc/doc_ch/environment.md b/doc/doc_ch/environment.md index 068c2a38..3a266c4b 100644 --- a/doc/doc_ch/environment.md +++ b/doc/doc_ch/environment.md @@ -15,7 +15,6 @@ Windows和Mac用户推荐使用Anaconda搭建Python环境,Linux用户建议使 + [1.2 Mac](#1.2) + [1.3 Linux](#1.3) * [2. 安装PaddlePaddle](#2) -* [3. 安装PaddleOCR依赖](#3) @@ -302,25 +301,17 @@ cd /home/Projects # 首次运行需创建一个docker容器,再次运行时不需要运行当前命令 # 创建一个名字为ppocr的docker容器,并将当前目录映射到容器的/paddle目录下 -如果您希望在CPU环境下使用docker,使用docker而不是nvidia-docker创建docker -sudo docker run --name ppocr -v $PWD:/paddle --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash +#如果您希望在CPU环境下使用docker,使用docker而不是nvidia-docker创建docker +sudo docker run --name ppocr -v $PWD:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash -如果使用CUDA10,请运行以下命令创建容器,设置docker容器共享内存shm-size为64G,建议设置32G以上 -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 +#如果使用CUDA10,请运行以下命令创建容器,设置docker容器共享内存shm-size为64G,建议设置32G以上 +# 如果是CUDA11+CUDNN8,推荐使用镜像registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda11.2-cudnn8 +sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash # ctrl+P+Q可退出docker 容器,重新进入docker 容器使用如下命令 sudo docker container exec -it ppocr /bin/bash ``` -docker 环境中默认的python3 版本为python3.5,PaddleOCR 建议使用Python3.7,在执行python命令时,可以使用python3.7而不是python3。如下,输入python3.7命令并回车,可以看到使用的是python3.7版本。 -``` -λ root@Linux /paddle python3.7 -Python 3.7.0 (default, Aug 2 2021, 05:30:22) -[GCC 8.2.0] on linux -Type "help", "copyright", "credits" or "license" for more information. ->>> -``` - ## 2. 安装PaddlePaddle @@ -328,39 +319,13 @@ Type "help", "copyright", "credits" or "license" for more information. - 如果您的机器安装的是CUDA9或CUDA10,请运行以下命令安装 ```bash -# use python3.7 instead of python3 in docker python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple ``` - 如果您的机器是CPU,请运行以下命令安装 ```bash -# use python3.7 instead of python3 in docker python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` 更多的版本需求,请参照[飞桨官网安装文档](https://www.paddlepaddle.org.cn/install/quick)中的说明进行操作。 - - -## 3. 安装PaddleOCR依赖 - -下载paddleOCR 代码 -``` -【推荐】git clone https://github.com/PaddlePaddle/PaddleOCR - -如果因为网络问题无法pull成功,也可选择使用码云上的托管: - -git clone https://gitee.com/paddlepaddle/PaddleOCR - -注:码云托管代码可能无法实时同步本github项目更新,存在3~5天延时,请优先使用推荐方式。 -``` - -安装PaddleOCR 依赖 -``` -cd PaddleOCR -pip3 install -r requirements.txt -# docker 中使用pip3.7 代替pip3 -# pip3.7 install -r requirements.txt -``` - -注意,windows环境下,建议从[这里](https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely)下载shapely安装包完成安装, 直接通过pip安装的shapely库可能出现[winRrror 126] 找不到指定模块的问题。 diff --git a/doc/doc_en/environment_en.md b/doc/doc_en/environment_en.md index a091955f..9aad92ca 100644 --- a/doc/doc_en/environment_en.md +++ b/doc/doc_en/environment_en.md @@ -11,7 +11,6 @@ Recommended working environment: + [1.2 Mac](#1.2) + [1.3 Linux](#1.3) * [2. Install PaddlePaddle 2.0](#2) -* [3. Install PaddleOCR Dependencies](#3) @@ -210,7 +209,6 @@ Linux users can choose to run either Anaconda or Docker. If you are familiar wit - - Select the appropriate version for your operating system - Type `uname -m` in the terminal to check the command set used by your system @@ -317,10 +315,11 @@ cd /home/Projects # Create a docker container named ppocr and map the current directory to the /paddle directory of the container # If using CPU, use docker instead of nvidia-docker to create docker -sudo docker run --name ppocr -v $PWD:/paddle --network=host -it paddlepaddle/paddle:latest-dev-cuda10.1-cudnn7-gcc82 /bin/bash +sudo docker run --name ppocr -v $PWD:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash # If using GPU, use nvidia-docker to create docker -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 +# docker image registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda11.2-cudnn8 is recommended for CUDA11.2 + CUDNN8. +sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash ``` You can also visit [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/) to get the image that fits your machine. @@ -330,15 +329,6 @@ You can also visit [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags sudo docker container exec -it ppocr /bin/bash ``` -The default python3 version in the docker environment is python3.5. Python3.7 is recommended to run PaddleOCR. When executing python commands, you can use python3.7 instead of python3. As follows, enter the python3.7 command and press Enter, you can see that the python3.7 version is used. -``` -λ root@Linux /paddle python3.7 -Python 3.7.0 (default, Aug 2 2021, 05:30:22) -[GCC 8.2.0] on linux -Type "help", "copyright", "credits" or "license" for more information. ->>> -``` - ## 2. Install PaddlePaddle 2.0 @@ -346,45 +336,13 @@ Type "help", "copyright", "credits" or "license" for more information. - If you have cuda9 or cuda10 installed on your machine, please run the following command to install ```bash -# use python3.7 instead of python3 in docker python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple ``` - If you only have cpu on your machine, please run the following command to install ```bash -# use python3.7 instead of python3 in docker python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple ``` For more software version requirements, please refer to the instructions in [Installation Document](https://www.paddlepaddle.org.cn/install/quick) for operation. - - -## 3. Install PaddleOCR Dependencies - -Download PaddleOCR code. -``` -# 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. -``` - -Install third-party libraries -``` -cd PaddleOCR -pip3 install -r requirements.txt -# use pip3.7 instead of pip3 in docker -# pip3.7 install -r requirements.txt - -``` - -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) -- GitLab