目录
1.首先安装docker和nvidia-docker
2.准备docker环境
2.克隆PaddleOCR repo代码
3.安装第三方库
附1:docker容器的常用命令
1.首先安装docker和nvidia-docker
https://blog.csdn.net/u013171226/article/details/115113220
2.准备docker环境
官网上面说明了CPU版本、cuda9版本、cuda10版本的docker环境创建命令,但是我的电脑是cuda11,因此我直接去 https://hub.docker.com/r/paddlepaddle/paddle/tags/ 网站找到下面的
然后pull镜像文件。
docker pull paddlepaddle/paddle:2.0.1-gpu-cuda11.0-cudnn8
然后根据下载的镜像文件创建docker容器。
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=252G --network=host -itd paddlepaddle/paddle:2.0.1-gpu-cuda11.0-cudnn8 /bin/bash
然后用docker ps看一下当前运行的docker容器
docker ps #查看当前运行的docker容器。
docker ps -a #查看所有存在的docker容器。
结果如下:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99aba9e2659f paddlepaddle/paddle:2.0.1-gpu-cuda11.0-cudnn8 "/bin/bash" About an hour ago Up About an hour ppocr
然后我们根据ID号进入docker环境:
docker exec -it 99aba9e2659f /bin/bash
2.克隆PaddleOCR repo代码
cd /paddle/
git clone https://github.com/PaddlePaddle/PaddleOCR
3.安装第三方库
cd PaddleOCR
pip3 install -r requirments.txt
刚开始运行的时候提示下面的错误:
ERROR: Could not find a version that satisfies the requirement scikit-image==0.17.2
ERROR: No matching distribution found for scikit-image==0.17.2
然后Python -V发现是Python3.5。怀疑是使用的Python和pip版本比较低,导致找不到0.17.2的版本。然后
λ boyun-DGX-1-with-V100-32 /paddle/PaddleOCR {release/2.0} find / -iname "python"
/var/lib/python
/etc/python
/usr/bin/python
/usr/bin/gcc-8.2.0/libstdc++-v3/python
/usr/local/lib/python3.5/dist-packages/paddle/include/third_party/google/protobuf/compiler/python
/usr/local/lib/python3.5/dist-packages/paddle/include/third_party/boost/mpi/python
/usr/local/lib/python3.5/dist-packages/paddle/include/third_party/boost/parameter/aux_/python
/usr/local/lib/python3.5/dist-packages/paddle/include/third_party/boost/python
/usr/local/lib/python3.5/dist-packages/virtualenv/activation/python
/usr/local/lib/python3.7/dist-packages/visualdl/python
/usr/local/lib/python3.7/dist-packages/paddle/include/third_party/google/protobuf/compiler/python
/usr/local/lib/python3.7/dist-packages/paddle/include/third_party/boost/mpi/python
/usr/local/lib/python3.7/dist-packages/paddle/include/third_party/boost/parameter/aux_/python
/usr/local/lib/python3.7/dist-packages/paddle/include/third_party/boost/python
/usr/local/lib/python3.7/dist-packages/virtualenv/activation/python
/usr/local/lib/python2.7/dist-packages/paddle/include/third_party/google/protobuf/compiler/python
/usr/local/lib/python2.7/dist-packages/paddle/include/third_party/boost/mpi/python
/usr/local/lib/python2.7/dist-packages/paddle/include/third_party/boost/parameter/aux_/python
/usr/local/lib/python2.7/dist-packages/paddle/include/third_party/boost/python
/usr/local/lib/python2.7/dist-packages/virtualenv/activation/python
/usr/local/lib/python3.6/dist-packages/paddle/include/third_party/google/protobuf/compiler/python
/usr/local/lib/python3.6/dist-packages/paddle/include/third_party/boost/mpi/python
/usr/local/lib/python3.6/dist-packages/paddle/include/third_party/boost/parameter/aux_/python
/usr/local/lib/python3.6/dist-packages/paddle/include/third_party/boost/python
/usr/local/lib/python3.6/dist-packages/virtualenv/activation/python
/usr/local/lib/python3.8/dist-packages/paddle/include/third_party/google/protobuf/compiler/python
/usr/local/lib/python3.8/dist-packages/paddle/include/third_party/boost/mpi/python
/usr/local/lib/python3.8/dist-packages/paddle/include/third_party/boost/parameter/aux_/python
/usr/local/lib/python3.8/dist-packages/paddle/include/third_party/boost/python
/usr/local/lib/python3.8/dist-packages/virtualenv/activation/python
/usr/local/gcc-8.2/share/gcc-8.2.0/python
/usr/local/TensorRT-7.1.3.4/doc/python
/usr/local/TensorRT-7.1.3.4/samples/python
/usr/local/TensorRT-7.1.3.4/python
/usr/local/cuda-11.0/share/gdb/python
/usr/share/doc/python
/usr/share/lintian/overrides/python
/usr/share/gcc-8/python
/usr/share/swig3.0/python
/usr/share/python
发现里面其实python3.5,python3.6,python3.7都有的,于是执行
ln -snf /usr/bin/python3.7 /usr/bin/python3
同样对于pip3,
λ boyun-DGX-1-with-V100-32 /paddle/PaddleOCR {release/2.0} find / -iname "pip"
/root/.cache/pip
/usr/local/lib/python3.5/dist-packages/pip
/usr/local/lib/python3.7/dist-packages/pip-20.0.1-py3.7.egg/pip
/usr/local/lib/python2.7/dist-packages/pip-20.0.1-py2.7.egg/pip
/usr/local/lib/python3.6/dist-packages/pip-20.0.1-py3.6.egg/pip
/usr/local/lib/python3.8/dist-packages/pip-20.0.1-py3.8.egg/pip
/usr/local/bin/pip
执行
ln -snf /usr/local/bin/pip3.7 /usr/local/bin/pip3
然后再执行pip3 install -r requirments.txt就可以安装成功了。
附1:docker容器的常用命令
https://blog.csdn.net/u013171226/article/details/115132594
参考文献:官网说明文档 https://www.bookstack.cn/read/PaddleOCR/installation.md