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

依赖无法安装 #456

Open
sitxiaochen opened this issue Sep 22, 2023 · 5 comments
Open

依赖无法安装 #456

sitxiaochen opened this issue Sep 22, 2023 · 5 comments

Comments

@sitxiaochen
Copy link

运行 pip install multidict==4.7.6 -i https://pypi.tuna.tsinghua.edu.cn/simple & pip install -r requirements.txt

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting multidict==4.7.6
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/65/d4/fabdcc5ee4451c8a8e177e27ddfd131a53a82ecc5a3b68468b7e9f8d70b4/multidict-4.7.6.tar.gz (50 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.0/51.0 kB ? eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
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
╰─> [82 lines of output]
**********************
* Accellerated build *
**********************
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-311
creating build\lib.win-amd64-cpython-311\multidict
copying multidict_abc.py -> build\lib.win-amd64-cpython-311\multidict
copying multidict_compat.py -> build\lib.win-amd64-cpython-311\multidict
copying multidict_multidict_base.py -> build\lib.win-amd64-cpython-311\multidict
copying multidict_multidict_py.py -> build\lib.win-amd64-cpython-311\multidict
copying multidict_init_.py -> build\lib.win-amd64-cpython-311\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-u2qswp9c\overlay\Lib\site-packages\setuptools\command\build_py.py:204: _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-311\multidict
  copying multidict\_multidict.c -> build\lib.win-amd64-cpython-311\multidict
  copying multidict\py.typed -> build\lib.win-amd64-cpython-311\multidict
  creating build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\defs.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\dict.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\istr.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\iter.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  copying multidict\_multilib\views.h -> build\lib.win-amd64-cpython-311\multidict\_multilib
  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

以上是报错,换了清华源还是这个依赖模块报错,大佬抽空看一下咋回事。

也不是项目新旧问题吧,每次我对一个项目感兴趣想自己动手学习的时候,每次都是依赖库报错,一开始是环境乱的要死,后面就是依赖库,有没有什么课程或者其他类似的资源可以去了解环境和依赖库的知识,麻烦大佬推荐一下谢谢,打算py入门哈哈哈。

@SeaHOH
Copy link

SeaHOH commented Sep 23, 2023

所谓依赖,不单单只是第三方包,还包括与其兼容匹配的版本。一般情况下,包发布者并不会为过时的版本补上后来才发布的 Python 对应二进制,具体情况可以到 PyPI 发布页查看。所以,这确实不是项目新旧问题,而是项目中没有标记 Python 具体版本,没有及时更新依赖,这其实并没有太大问题。只是,当你使用新版 Python 时,那些指定版本且包含二进制的依赖是过时失效的,纯脚本包则不会有这个问题。

解决方案,三选一:

  • 安装旧版 Python,也就是当时作者使用的版本 (应该是 3.8),完全复制当时的环境。
    操作简单,但如果新旧 Python 共存,使用时需切换版本,略麻烦。

  • 全部依赖都安装当前 Python 下可用的最新版本,如果包之间出现版本冲突,或者脚本不兼容新版依赖,就再调整包版本。
    一般来讲,都会一次通过,使用上没什么变化。

  • 安装依赖的编译环境并编译安装。
    不建议尝试,因为时间久了后,编译环境和依赖本身也都可能会有各种原因导致的版本和依赖问题的。

@sitxiaochen
Copy link
Author

十分感谢,看了你的回答我豁然开朗,我看待这个依赖模块角度很高,我整体化思想比较严重,没有想到把任何一个数据都看作一个个体,这样看来我之前的所有报错都十分合理。环境在我眼里又变的比我之前想的要苛刻和严谨,依赖又比我之前想的灵活很多,再次十分感谢能在百忙之中回答我这个门外汉的疑惑。谢谢!!!

@sitxiaochen
Copy link
Author

py:3.11.5
所有依赖更新为最新稳定版。
问题解决。

@happycode202
Copy link

python 3.11.5
更新下依赖:

aiohttp==3.8.5
async-timeout==4.0.3
attrs==23.1.0
certifi==2023.7.22
chardet==5.2.0
idna==3.4
multidict==6.0.4
protobuf==4.24.3
pycryptodome==3.19.0
PyExecJS==1.5.1
requests==2.31.0
six==1.16.0
typing-extensions==4.8.0
urllib3==2.0.5
yarl==1.9.2

@happycode202
Copy link

如果python版本为3.12
可以更改
aiohttp==3.9.0b0

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

No branches or pull requests

3 participants