python config_error ai_generated true

ERROR: The index URL 'http://pypi.example.com/simple' is not secure. pip requires HTTPS for all index URLs by default.

ID: python/pip-index-url-http-blocked

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-09-03First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

pip refuses plain HTTP index URLs unless explicitly trusted. Internal mirrors are often HTTP-only, so pip blocks them to prevent MITM tampering.

generic

中文

除非显式信任,否则 pip 拒绝纯 HTTP 索引 URL。内部镜像通常仅支持 HTTP,因此 pip 会阻止它们以防止 MITM 篡改。

Workarounds

  1. 95% success
    pip install --index-url http://pypi.example.com/simple --trusted-host pypi.example.com package
  2. 92% success
    pip config set global.trusted-host pypi.example.com && pip config set global.index-url http://pypi.example.com/simple
  3. 98% success
    Configure the mirror with a valid TLS cert; then use https:// URL

Dead Ends

Common approaches that don't work:

  1. 95% fail

    pip still refuses unless --trusted-host is added.

  2. 90% fail

    Same rejection; the env var does not imply trust.