develop版本fastdeploy win下安装错误

604 阅读4分钟

携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第20天,点击查看活动详情

fastdeploy win下安装

1.遇到问题

  • 第一步:git下载源码
 git clone -b develop https://github.com/PaddlePaddle/FastDeploy.git --depth=1
  • 第二步:安装依赖
pip install -r requirements.txt
  • 第二步:源码安装
pip install -e ./

Obtaining file:///C:/Users/Administrator/Desktop/FastDeploy
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 107, in <module>
          assert CMAKE, 'Could not find "cmake" executable!'
      AssertionError: Could not find "cmake" executable!
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
  • 第四步:安装cmake
 pip install -e ./
 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
 Obtaining file:///C:/Users/Administrator/Desktop/FastDeploy
   Preparing metadata (setup.py) ... error
   error: subprocess-exited-with-error
 
   × python setup.py egg_info did not run successfully.
   │ exit code: 1
   ╰─> [6 lines of output]
       Traceback (most recent call last):
         File "<string>", line 2, in <module>
         File "<pip-setuptools-caller>", line 34, in <module>
         File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 107, in <module>
           assert CMAKE, 'Could not find "cmake" executable!'
       AssertionError: Could not find "cmake" executable!
       [end of output]
 
   note: This error originates from a subprocess, and is likely not a problem with pip.
 error: metadata-generation-failed
 
 × Encountered error while generating package metadata.
 ╰─> See above for output.
 
 note: This is an issue with the package mentioned above, not pip.
 hint: See above for details.
  • 第五步:再次安装

  • pip install -e ./
    Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
    Obtaining file:///C:/Users/Administrator/Desktop/FastDeploy
      Preparing metadata (setup.py) ... done
    Requirement already satisfied: requests in c:\miniconda3\envs\p2\lib\site-packages (from fastdeploy-python==0.2.0) (2.28.1)
    Requirement already satisfied: tqdm in c:\miniconda3\envs\p2\lib\site-packages (from fastdeploy-python==0.2.0) (4.64.0)
    Requirement already satisfied: charset-normalizer<3,>=2 in c:\miniconda3\envs\p2\lib\site-packages (from requests->fastdeploy-python==0.2.0) (2.1.0)
    Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\miniconda3\envs\p2\lib\site-packages (from requests->fastdeploy-python==0.2.0) (1.26.11)
    Requirement already satisfied: idna<4,>=2.5 in c:\miniconda3\envs\p2\lib\site-packages (from requests->fastdeploy-python==0.2.0) (3.3)
    Requirement already satisfied: certifi>=2017.4.17 in c:\miniconda3\envs\p2\lib\site-packages (from requests->fastdeploy-python==0.2.0) (2022.6.15)
    Requirement already satisfied: colorama in c:\miniconda3\envs\p2\lib\site-packages (from tqdm->fastdeploy-python==0.2.0) (0.4.5)
    Installing collected packages: fastdeploy-python
      Running setup.py develop for fastdeploy-python
        error: subprocess-exited-with-error
    
        × python setup.py develop did not run successfully.
        │ exit code: 1
        ╰─> [63 lines of output]
            running develop
            C:\miniconda3\envs\p2\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
              warnings.warn(
            C:\miniconda3\envs\p2\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
              warnings.warn(
            running build_py
            running create_version
            running cmake_build
            -- Building for: Visual Studio 16 2019
            -- Selecting Windows SDK version  to target Windows 10.0.22621.
            -- The C compiler identification is unknown
            -- The CXX compiler identification is unknown
            CMake Error at CMakeLists.txt:15 (PROJECT):
              No CMAKE_C_COMPILER could be found.
    
    
    
            CMake Error at CMakeLists.txt:15 (PROJECT):
              No CMAKE_CXX_COMPILER could be found.
    
    
    
            -- Configuring incomplete, errors occurred!
            See also "C:/Users/Administrator/Desktop/FastDeploy/.setuptools-cmake-build/CMakeFiles/CMakeOutput.log".
            See also "C:/Users/Administrator/Desktop/FastDeploy/.setuptools-cmake-build/CMakeFiles/CMakeError.log".
            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 34, in <module>
              File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 475, in <module>
                setuptools.setup(
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\__init__.py", line 87, in setup
                return distutils.core.setup(**attrs)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
                return run_commands(dist)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
                dist.run_commands()
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
                self.run_command(cmd)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\dist.py", line 1214, in run_command
                super().run_command(command)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
                cmd_obj.run()
              File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 261, in run
                self.run_command('build_py')
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\dist.py", line 1214, in run_command
                super().run_command(command)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
                cmd_obj.run()
              File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 246, in run
                self.run_command('cmake_build')
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\dist.py", line 1214, in run_command
                super().run_command(command)
              File "C:\miniconda3\envs\p2\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
                cmd_obj.run()
              File "C:\Users\Administrator\Desktop\FastDeploy\setup.py", line 232, in run
                subprocess.check_call(cmake_args)
              File "C:\miniconda3\envs\p2\lib\subprocess.py", line 373, in check_call
                raise CalledProcessError(retcode, cmd)
            subprocess.CalledProcessError: Command '['C:\\miniconda3\\envs\\p2\\Scripts\\cmake.exe', '-DPYTHON_INCLUDE_DIR=C:\\miniconda3\\envs\\p2\\include', '-DPYTHON_EXECUTABLE=C:\\miniconda3\\envs\\p2\\python.exe', '-DBUILD_FASTDEPLOY_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=paddle2onnx', '-DPY_EXT_SUFFIX=.cp39-win_amd64.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DENABLE_PADDLE_FRONTEND=ON', '-DENABLE_ORT_BACKEND=ON', '-DENABLE_PADDLE_BACKEND=OFF', '-DBUILD_DEMO=ON', '-DENABLE_VISION=ON', '-DENABLE_TRT_BACKEND=OFF', '-DWITH_GPU=OFF', '-DTRT_DIRECTORY=UNDEFINED', '-DCUDA_DIRECTORY=/usr/local/cuda', '-DLIBRARY_NAME=fastdeploy', '-DPY_LIBRARY_NAME=fastdeploy_main', '-DPY_VERSION=3.9', '-A', 'x64', '-T', 'host=x64', 'C:\\Users\\Administrator\\Desktop\\FastDeploy']' returned non-zero exit status 1.
            [end of output]
    
        note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [63 lines of output]
        running develop
        C:\miniconda3\envs\p2\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        C:\miniconda3\envs\p2\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        running build_py
        running create_version
        running cmake_build
        -- Building for: Visual Studio 16 2019
        -- Selecting Windows SDK version  to target Windows 10.0.22621.
        -- The C compiler identification is unknown
        -- The CXX compiler identification is unknown
        CMake Error at CMakeLists.txt:15 (PROJECT):
          No CMAKE_C_COMPILER could be found.
          。
          。
          。
    note: This error originates from a subprocess, and is likely not a problem with pip.      
    
  • 第六步:cmake设置

(p2) C:\Users\Administrator\Desktop\FastDeploy>cmake -G "MinGW Makefiles" -D"CMAKE_MAKE_PROGRAM:PATH=C:\miniconda3\envs\p2\Lib\site-packages\cmake\data\bin/make.exe"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:15 (PROJECT):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:15 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C:/Users/Administrator/Desktop/FastDeploy/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Administrator/Desktop/FastDeploy/CMakeFiles/CMakeError.log".
  • 第七步: subprocess解决办法
 (p2) C:\Users\Administrator\Desktop\FastDeploy>pip install importlib_metadata --force-reinstall
 Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
 Collecting importlib_metadata
   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d2/a2/8c239dc898138f208dd14b441b196e7b3032b94d3137d9d8453e186967fc/importlib_metadata-4.12.0-py3-none-any.whl (21 kB)
 Collecting zipp>=0.5
   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f0/36/639d6742bcc3ffdce8b85c31d79fcfae7bb04b95f0e5c4c6f8b206a038cc/zipp-3.8.1-py3-none-any.whl (5.6 kB)
 Installing collected packages: zipp, importlib_metadata
 Successfully installed importlib_metadata-4.12.0 zipp-3.8.1