tflite 支持的构建轮失败

问题描述 投票:0回答:1

使用

pip install tflite-support
,这是完整的输出和错误消息:

Collecting tflite-support
  Using cached tflite-support-0.1.0a1.tar.gz (390 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.4 in c:\users\luisd\appdata\local\programs\python\python312\lib\site-packages (from tflite-support) (2.13.5)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\luisd\appdata\local\programs\python\python312\lib\site-packages (from tflite-support) (2.1.0)
Requirement already satisfied: numpy in c:\users\luisd\appdata\local\programs\python\python312\lib\site-packages (from tflite-support) (1.26.4)
Building wheels for collected packages: tflite-support
  Building wheel for tflite-support (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [95 lines of output]
      C:\Users\luisd\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\tflite_support
      copying tflite_support\codegen.py -> build\lib.win-amd64-cpython-312\tflite_support
      copying tflite_support\metadata.py -> build\lib.win-amd64-cpython-312\tflite_support
      copying tflite_support\metadata_schema_py_generated.py -> build\lib.win-amd64-cpython-312\tflite_support
      copying tflite_support\schema_py_generated.py -> build\lib.win-amd64-cpython-312\tflite_support
      copying tflite_support\__init__.py -> build\lib.win-amd64-cpython-312\tflite_support
      running egg_info
      writing tflite_support.egg-info\PKG-INFO
      writing dependency_links to tflite_support.egg-info\dependency_links.txt
      writing entry points to tflite_support.egg-info\entry_points.txt
      writing requirements to tflite_support.egg-info\requires.txt
      writing top-level names to tflite_support.egg-info\top_level.txt
      reading manifest file 'tflite_support.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      writing manifest file 'tflite_support.egg-info\SOURCES.txt'
      C:\Users\luisd\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\command\build_py.py:218: _Warning: Package 'tflite_support.flatbuffers' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'tflite_support.flatbuffers' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'tflite_support.flatbuffers' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'tflite_support.flatbuffers' to be distributed and are
              already explicitly excluding 'tflite_support.flatbuffers' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      copying tflite_support\metadata_schema.fbs -> build\lib.win-amd64-cpython-312\tflite_support
      creating build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\__init__.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\builder.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\compat.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\encode.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\number_types.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\packer.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\table.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      copying tflite_support\flatbuffers\util.py -> build\lib.win-amd64-cpython-312\tflite_support\flatbuffers
      running build_ext
      building '_pywrap_codegen' extension
      creating build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release
      creating build\temp.win-amd64-cpython-312\Release\src
      creating build\temp.win-amd64-cpython-312\Release\src\tensorflow
      creating build\temp.win-amd64-cpython-312\Release\src\tensorflow\lite
      creating build\temp.win-amd64-cpython-312\Release\src\tensorflow\lite\experimental
      creating build\temp.win-amd64-cpython-312\Release\src\tensorflow\lite\experimental\support
      creating build\temp.win-amd64-cpython-312\Release\src\tensorflow\lite\experimental\support\codegen
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\luisd\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include -IC:\Users\luisd\AppData\Local\Programs\Python\Python312\Lib\site-packages\pybind11\include -Iinclude -Isrc -IC:\Users\luisd\AppData\Local\Programs\Python\Python312\include -IC:\Users\luisd\AppData\Local\Programs\Python\Python312\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" /EHsc /Tpsrc\tensorflow\lite\experimental\support\codegen\android_java_generator.cc /Fobuild\temp.win-amd64-cpython-312\Release\src\tensorflow\lite\experimental\support\codegen\android_java_generator.obj /EHsc /DVERSION_INFO=\\\"0.1.0a1\\\"
      android_java_generator.cc
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\include\yvals.h(20): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tflite-support
  Running setup.py clean for tflite-support
Failed to build tflite-support
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (tflite-support)

我尝试了

pip install tflite-support --use-pep517
,但也不起作用。

有人可以帮助我吗?

python windows pip tensorflow-lite python-wheel
1个回答
0
投票

我今天遇到了同样的问题;它应该与Python版本(3.12)有关。 安装 Python 3.11 后, pip install tflite-support 对我有用。

如果有人在安装 Python 3.11 时遇到问题(就像我在 Manjaro Linux 上所做的那样),这是我使用的解决方案:

  1. 安装 pyenv(macOS、Linux)或 pyenv-win(Windows),然后运行:
  2. pyenv 安装 3.11
  3. pyenv 全局 3.11
  4. python -V #输出应该是Python 3.11.10
  5. pip install --upgrade pip #如果需要
  6. pip 安装 tflite-support

点列表的输出应该是: absl-py 2.1.0、cffi 1.17.1、平面缓冲区 24.3.25、numpy 2.1.3、pip 24.3.1、protobuf 3.20.3、pybind11 2.13.6、pycparser 2.22、setuptools 65.5.0、sounddevice 0.5.1、 tflite-支持 0.4.4

© www.soinside.com 2019 - 2024. All rights reserved.