ERROR pip install_error ai_generated true

错误:包 'X' 没有 'pyproject.toml' 或 'setup.py'

ERROR: Package 'X' has no 'pyproject.toml' or 'setup.py'

ID: pip/package-has-no-pyproject-toml-or-setup-py

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2023-05-10首次发现

版本兼容性

版本状态引入弃用备注
pip 21.3+ active
Python 3.7-3.12 active

根因分析

该包要么不是有效的 Python 包,要么索引 URL 错误,或者包名拼写错误,导致 pip 无法找到任何构建元数据。

English

The package is either not a valid Python package, the index URL is wrong, or the package name is misspelled, causing pip to fail to find any build metadata.

generic

官方文档

https://pip.pypa.io/en/stable/topics/packaging/

解决方案

  1. pip install --no-index --find-links=/path/to/wheels <包名>
  2. pip install <包名>==<确切版本> --only-binary=:all:
  3. pip install <包名> -i https://pypi.org/simple/ --trusted-host pypi.org

无效尝试

常见但无效的做法:

  1. Installing the package with --no-build-isolation flag 95% 失败

    The flag only disables build isolation; if the package has no build files at all, this still fails.

  2. Upgrading pip to the latest version 90% 失败

    The error is about missing package metadata, not pip's resolver or version compatibility.

  3. Running pip install with --verbose to get more details 85% 失败

    Verbose output does not provide missing build files; the root cause remains the same.