Press "Enter" to skip to content

PaddlePaddle/FastDeploy 编译报错处理

参考:https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/cpu.md

进行编译安装:

环境 centos 容器

FROM centos:8.3.2011

RUN sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
RUN sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*

RUN yum update -y
RUN yum install gcc make python3-devel openssl-devel mesa-libGL bzip2-devel libffi-devel zlib-devel xz-devel sqlite-devel unzip -y


COPY Python-3.9.6.tgz /Python-3.9.6.tgz
RUN tar -zxvf /Python-3.9.6.tgz
RUN cd /Python-3.9.6
RUN /Python-3.9.6/configure --enable-loadable-sqlite-extensions --enable-optimizations
RUN make altinstall

RUN pip3.9 install --upgrade pip

上面是基础环境

git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/python
export ENABLE_ORT_BACKEND=ON
export ENABLE_PADDLE_BACKEND=ON
export ENABLE_OPENVINO_BACKEND=ON
export ENABLE_VISION=ON
export ENABLE_TEXT=ON
# OPENCV_DIRECTORY可选,不指定会自动下载FastDeploy提供的预编译OpenCV库
export OPENCV_DIRECTORY=/usr/lib/x86_64-linux-gnu/cmake/opencv4

yum install -y cmake
yum groupinstall -y 'Development Tools'

pip3.9 install wheel

python3.9 setup.py build
python3.9 setup.py bdist_wheel

执行 python3.9 setup.py build的时候一直报错:

 File "/root/FastDeploy/python/setup.py", line 445, in <module>
    setuptools.setup(
  File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.9/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/root/FastDeploy/python/setup.py", line 308, in run
    self.run_command('cmake_build')
  File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/root/FastDeploy/python/setup.py", line 302, in run
    subprocess.check_call(build_args)
  File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/cmake3', '--build', '.', '--', '-j', '12']' returned non-zero exit status 2.

最后看到 大哥 https://github.com/PaddlePaddle/FastDeploy/issues/1671

sudo ln -s /usr/bin/python3 /usr/bin/python

就行了,需要帮 python3链接到 /usr/bin/python。我的python环境用下面命令

ln -s /usr/local/bin/python3.9 /usr/bin/python
发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注