python network_error ai_generated true

WARNING: The repository located at myrepo.local is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host myrepo.local'. ERROR: Could not find a version that satisfies the requirement mypkg

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

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

pip refuses to use an HTTP (non-TLS) index unless the host is explicitly marked as trusted.

generic

中文

除非主机被明确标记为受信任,否则 pip 拒绝使用 HTTP(非 TLS)索引。

Workarounds

  1. 95% success
    pip install --index-url http://myrepo.local/simple --trusted-host myrepo.local mypkg
  2. 90% success
    # ~/.config/pip/pip.conf
    [global]
    index-url = http://myrepo.local/simple
    trusted-host = myrepo.local

Dead Ends

Common approaches that don't work:

  1. 90% fail

    HTTP index is still rejected without --trusted-host.

  2. 85% fail

    Environment variable changes the index but not the trust decision.

  3. 95% fail

    Cache does not affect trust evaluation of the index host.