Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Python 3.12 multidict 构建失败 #214

Closed
3 tasks done
SigureMo opened this issue Jan 6, 2024 · 1 comment · Fixed by #218
Closed
3 tasks done

🐛 Python 3.12 multidict 构建失败 #214

SigureMo opened this issue Jan 6, 2024 · 1 comment · Fixed by #218

Comments

@SigureMo
Copy link
Member

SigureMo commented Jan 6, 2024

问题简述

使用 Python 3.12 安装 yutto 时发生如下错误:

Building wheels for collected packages: multidict
  Building wheel for multidict (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for multidict (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [74 lines of output]
      *********************
      * Accelerated build *
      *********************
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\multidict
      copying multidict\_abc.py -> build\lib.win-amd64-cpython-312\multidict
      copying multidict\_compat.py -> build\lib.win-amd64-cpython-312\multidict
      copying multidict\_multidict_base.py -> build\lib.win-amd64-cpython-312\multidict
      copying multidict\_multidict_py.py -> build\lib.win-amd64-cpython-312\multidict
      copying multidict\__init__.py -> build\lib.win-amd64-cpython-312\multidict
      running egg_info
      writing multidict.egg-info\PKG-INFO
      writing dependency_links to multidict.egg-info\dependency_links.txt
      writing top-level names to multidict.egg-info\top_level.txt
      reading manifest file 'multidict.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files found matching 'multidict\_multidict.html'
      warning: no previously-included files found matching 'multidict\*.so'
      warning: no previously-included files found matching 'multidict\*.pyd'
      warning: no previously-included files found matching 'multidict\*.pyd'
      no previously-included directories found matching 'docs\_build'
      adding license file 'LICENSE'
      writing manifest file 'multidict.egg-info\SOURCES.txt'
      C:\Users\Administrator\AppData\Local\Temp\pip-build-env-ltk_r5gf\overlay\Lib\site-packages\setuptools\command\build_py.py:207: _Warning: Package 'multidict._multilib' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'multidict._multilib' 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 'multidict._multilib' 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 'multidict._multilib' to be distributed and are
              already explicitly excluding 'multidict._multilib' 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 multidict\__init__.pyi -> build\lib.win-amd64-cpython-312\multidict
      copying multidict\py.typed -> build\lib.win-amd64-cpython-312\multidict
      running build_ext
      building 'multidict._multidict' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for multidict
Failed to build multidict
ERROR: Could not build wheels for multidict, which is required to install pyproject.toml-based projects

复现方式

pip install yutto

环境信息

系统无关

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是 yutto 本身的问题
  • 本 issue 在 issuesdiscussion 中并没有重复问题
@SigureMo
Copy link
Member Author

SigureMo commented Jan 6, 2024

该问题是上游 aiohttp 依赖的 multidict 未发布 3.12 pre-built wheel 包的问题,见 aio-libs/multidict#887

有以下三种解决方案:

  1. 按照 error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ 安装 build tools,将会在安装时自动构建(但不保证构建成功)

  2. 安装时设置环境变量 MULTIDICT_NO_EXTENSIONS=1 暂时解决,可参考 https://github.com/aio-libs/multidict#library-installation ,但非构建版本可能会慢很多

  3. 使用 Python 3.9-3.11 安装 yutto,比如使用 pipx 时指定 Python:

    pipx install yutto --python python3.11

受限于 aiohttp,yutto 对 Python 3.12 的支持非常缓慢,有点想换了……(但并不喜欢 httpx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant