[2022-05-10 12:06:31] The conflict is caused by:
[2022-05-10 12:06:31] paddle-serving-server-gpu 0.8.3.post101 depends on grpcio<=1.33.2
[2022-05-10 12:06:31] paddle-serving-client 0.8.3 depends on grpcio<=1.33.2
[2022-05-10 12:06:31] pymilvus 2.0.2 depends on grpcio==1.37.1
[2022-05-10 12:06:31]
[2022-05-10 12:06:31] To fix this you could try to:
[2022-05-10 12:06:31] 1. loosen the range of package versions you've specified
[2022-05-10 12:06:31] 2. remove package versions to allow pip attempt to solve the dependency
解决方案,重新Serving编包
参考文件:https://github.com/PaddlePaddle/Serving/blob/v0.8.3/doc/Compile_CN.md
修改requirements.txt和编译参数中grpc版本依赖,重新Serving编包
修改requirements.txt和 go install google.golang.org/grpc@v1.33.0,都改成高版本
编译出来的包是0.0.0.0,不需要上传到pypi了,自己用就行
docker pull registry.baidubce.com/paddlepaddle/serving:0.8.0-cuda11.2-cudnn8-devel-with-codes
0.2、创建容器
nvidia-docker run --rm -it registry.baidubce.com/paddlepaddle/serving:0.8.0-cuda11.2-cudnn8-devel-with-codes bash
0.3、拷贝容器的第三方依赖到宿主机
docker cp 6225f86a207e:/home/Serving/server-build-gpu-opencv/third_party/ /data/mart/build_server/third_party/
docker cp 6225f86a207e:/home/Serving/client-build/third_party/ /data/mart/build_client/third_party/
docker cp 6225f86a207e:/root/.cache/ /data/mart/root/.cache/
docker cp 6225f86a207e:/home/Serving/core/cube/cube-agent/src/github.com/ /data/mart/github/
1、编译环境准备,我们首先要针对自己所需的环境拉取相关镜像。上表环境一列下,除了CPU,其余(Cuda**+Cudnn**)都属于GPU环境。 您可以使用Serving开发镜像。
docker pull registry.baidubce.com/paddlepaddle/serving:0.8.0-cuda10.1-cudnn7-devel
# 如果是GPU镜像
nvidia-docker run --rm -it registry.baidubce.com/paddlepaddle/serving:0.8.0-cuda10.1-cudnn7-devel bash
2、下载代码库
子模块,讲解:https://blog.csdn.net/guotianqing/article/details/82391665
git clone https://github.com/PaddlePaddle/Serving
cd Serving && git submodule update --init --recursive
3、环境变量准备
3.1、设置PYTHON环境变量
3.1.1、设置PYTHON_INCLUDE_DIR
find / -name Python.h
export PYTHON_INCLUDE_DIR=/usr/local/include/python3.7m/
3.1.2、设置PYTHON_LIBRARIES
find / -name libpython3.7.so
find / -name libpython3.7m.so
export PYTHON_LIBRARIES=/usr/local/lib
3.1.3、设置PYTHON_EXECUTABLE
which python3.7
export PYTHON_EXECUTABLE=/usr/local/bin/python3.7
4、更改requirements.txt
修改requirements.txt和 go install google.golang.org/grpc@v1.33.0,都改成高版本
cd python
vim requirements.txt
i
:wq
cd ..
5、配置安装
修改requirements.txt和 go install google.golang.org/grpc@v1.33.0,都改成高版本
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
python3.7 -m pip install -r python/requirements.txt -i https://mirror.baidu.com/pypi/simple
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.15.2
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v1.15.2
go install github.com/golang/protobuf/protoc-gen-go@v1.4.3
go install google.golang.org/grpc@v1.37.1
go env -w GO111MODULE=auto
6、配置GPU
export CUDA_PATH='/usr/local/cuda'
export CUDNN_LIBRARY='/usr/local/cuda/lib64/'
export CUDA_CUDART_LIBRARY="/usr/local/cuda/lib64/"
export TENSORRT_LIBRARY_PATH="/usr/"
7、编译paddle-serving-server
7.1 把容器的第三方依赖从宿主机拷贝进来
mkdir build_server
mkdir build_client
docker cp /data/mart/build_server/third_party/ ea1301ebf2a3:/home/Serving/build_server/third_party/
docker cp /data/mart/build_client/third_party/ ea1301ebf2a3:/home/Serving/build_client/third_party/
docker cp /data/mart/root/.cache/ ea1301ebf2a3:/root/.cache/
docker cp /data/mart/github.com/ ea1301ebf2a3:/home/Serving/core/cube/cube-agent/src/
7.2 执行编译
cd build_server
cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DPYTHON_LIBRARIES=$PYTHON_LIBRARIES \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_PATH} \
-DCUDNN_LIBRARY=${CUDNN_LIBRARY} \
-DCUDA_CUDART_LIBRARY=${CUDA_CUDART_LIBRARY} \
-DTENSORRT_ROOT=${TENSORRT_LIBRARY_PATH} \
-DSERVER=ON \
-DWITH_GPU=ON ..
make -j20
cd ..
7.3、编译paddle-serving-client 和 paddle-serving-app
# 编译paddle-serving-client
cd build_client
cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DPYTHON_LIBRARIES=$PYTHON_LIBRARIES \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
-DCLIENT=ON ..
make -j10
cd ..
# 编译paddle-serving-app
mkdir build_app
cd build_app
cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DPYTHON_LIBRARIES=$PYTHON_LIBRARIES \
-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
-DAPP=ON ..
make -j10
cd ..
8、把编译成功的包拷贝到本地
docker cp 8a3eb7d0bde0:/home/Serving/build_server/python/dist/ /data/mart/build_server
docker cp 8a3eb7d0bde0:/home/Serving/build_client/python/dist/ /data/mart/build_client
以上 *** 作同时解决了,如下安装过程报错
CMakeFiles/extern_snappy.dir/build.make:90: recipe for target 'third_party/snappy/src/extern_snappy-stamp/extern_snappy-download' failed
make[2]: *** [third_party/snappy/src/extern_snappy-stamp/extern_snappy-download] Error 1
CMakeFiles/Makefile2:676: recipe for target 'CMakeFiles/extern_snappy.dir/all' failed
make[1]: *** [CMakeFiles/extern_snappy.dir/all] Error 2
CMakeFiles/extern_utf8proc.dir/build.make:90: recipe for target 'third_party/utf8proc/src/extern_utf8proc-stamp/extern_utf8proc-download' failed
make[2]: *** [third_party/utf8proc/src/extern_utf8proc-stamp/extern_utf8proc-download] Error 1
CMakeFiles/Makefile2:622: recipe for target 'CMakeFiles/extern_utf8proc.dir/all' failed
make[1]: *** [CMakeFiles/extern_utf8proc.dir/all] Error 2
fatal: unable to access 'https://github.com/gflags/gflags.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
-- Had to git clone more than once:
3 times.
CMake Error at /home/Serving/build_server/third_party/gflags/tmp/extern_gflags-gitclone.cmake:31 (message):
Failed to clone repository: 'https://github.com/gflags/gflags.git'
CMakeFiles/extern_gflags.dir/build.make:90: recipe for target 'third_party/gflags/src/extern_gflags-stamp/extern_gflags-download' failed
make[2]: *** [third_party/gflags/src/extern_gflags-stamp/extern_gflags-download] Error 1
CMakeFiles/Makefile2:757: recipe for target 'CMakeFiles/extern_gflags.dir/all' failed
make[1]: *** [CMakeFiles/extern_gflags.dir/all] Error 2
fatal: unable to access 'https://github.com/pybind/pybind11.git/': Failed to connect to github.com port 443: Connection timed out
fatal: unable to access 'https://github.com/madler/zlib.git/': Failed to connect to github.com port 443: Connection timed out
-- Had to git clone more than once:
3 times.
CMake Error at /home/Serving/build_server/third_party/pybind/tmp/extern_pybind-gitclone.cmake:31 (message):
Failed to clone repository: 'https://github.com/pybind/pybind11.git'
-- Had to git clone more than once:
3 times.
CMake Error at /home/Serving/build_server/third_party/zlib/tmp/extern_zlib-gitclone.cmake:31 (message):
Failed to clone repository: 'https://github.com/madler/zlib.git'
CMakeFiles/extern_pybind.dir/build.make:91: recipe for target 'third_party/pybind/src/extern_pybind-stamp/extern_pybind-download' failed
make[2]: *** [third_party/pybind/src/extern_pybind-stamp/extern_pybind-download] Error 1
CMakeFiles/Makefile2:541: recipe for target 'CMakeFiles/extern_pybind.dir/all' failed
make[1]: *** [CMakeFiles/extern_pybind.dir/all] Error 2
CMakeFiles/extern_zlib.dir/build.make:90: recipe for target 'third_party/zlib/src/extern_zlib-stamp/extern_zlib-download' failed
make[2]: *** [third_party/zlib/src/extern_zlib-stamp/extern_zlib-download] Error 1
CMakeFiles/Makefile2:730: recipe for target 'CMakeFiles/extern_zlib.dir/all' failed
make[1]: *** [CMakeFiles/extern_zlib.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
还是报错,直接安装编译好的whl
whl包:
https://paddle-qa.bj.bcebos.com/PaddleServing/grpcio1.37.1/paddle_serving_app-0.8.3-py3-none-any.whl
https://paddle-qa.bj.bcebos.com/PaddleServing/grpcio1.37.1/paddle_serving_client-0.8.3-cp37-none-any.whl
https://paddle-qa.bj.bcebos.com/PaddleServing/grpcio1.37.1/paddle_serving_server_gpu-0.8.3.post101-py3-none-any.whl
bin:
https://paddle-qa.bj.bcebos.com/PaddleServing/grpcio1.37.1/serving-gpu-101-0.8.3.tar.gz
要把 Serving的bin文件拷贝到pip install paddle_serving_server的目录下,或者 export SERVING_BIN=serving bin的绝对路径
注意到上一小节的最后一行export SERVING_BIN,运行python端Server时,会检查SERVING_BIN环境变量,如果想使用自己编译的二进制文件,请将设置该环境变量为对应二进制文件的路径,通常是export SERVING_BIN= B U I L D D I R / c o r e / g e n e r a l − s e r v e r / s e r v i n g 。 其 中 B U I L D D I R 为 b u i l d s e r v e r 的 绝 对 路 径 。 可 以 c d b u i l d s e r v e r 路 径 下 , 执 行 e x p o r t S E R V I N G B I N = {BUILD_DIR}/core/general-server/serving。 其中BUILD_DIR为build_server的绝对路径。 可以cd build_server路径下,执行export SERVING_BIN= BUILDDIR/core/general−server/serving。其中BUILDDIR为buildserver的绝对路径。可以cdbuildserver路径下,执行exportSERVINGBIN={PWD}/core/general-server/serving
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)