ERROR pip config_error ai_generated true

ERROR: Invalid requirement: 'http://example.com/package.zip' - Expected file://, https://, or a valid package name.

ID: pip/url-invalid-requirement-scheme

Also available as: JSON · Markdown · 中文
95%Fix Rate
88%Confidence
1Evidence
2023-05-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.0 active
pip 22.0 active
pip 23.0 active
pip 24.0 active

Root Cause

pip does not support plain HTTP URLs for package installation due to security reasons; only HTTPS, file://, or package names are allowed.

generic

中文

出于安全原因,pip 不支持使用纯 HTTP URL 安装包;只允许 HTTPS、file:// 或包名称。

Official Documentation

https://pip.pypa.io/en/stable/topics/secure-installs/

Workarounds

  1. 90% success Change the URL to HTTPS: pip install https://example.com/package.zip (if HTTPS is available).
    Change the URL to HTTPS: pip install https://example.com/package.zip (if HTTPS is available).
  2. 95% success Download the file manually and install from local: wget http://example.com/package.zip && pip install ./package.zip
    Download the file manually and install from local: wget http://example.com/package.zip && pip install ./package.zip
  3. 85% success Use a local file server with HTTPS or serve over file://: pip install file:///path/to/package.zip
    Use a local file server with HTTPS or serve over file://: pip install file:///path/to/package.zip

中文步骤

  1. Change the URL to HTTPS: pip install https://example.com/package.zip (if HTTPS is available).
  2. Download the file manually and install from local: wget http://example.com/package.zip && pip install ./package.zip
  3. Use a local file server with HTTPS or serve over file://: pip install file:///path/to/package.zip

Dead Ends

Common approaches that don't work:

  1. 90% fail

    The --trusted-host flag only affects index URLs, not direct URL requirements; the error remains.

  2. 100% fail

    Same validation applies to requirements files; pip rejects HTTP URLs everywhere.

  3. 100% fail

    The --no-deps flag does not change URL scheme validation; still fails.