【发布时间】:2023-03-19 19:42:01
【问题描述】:
我正在尝试从压缩存档 URL 安装 python 模块,该压缩存档 URL 是 gitlab 私有 repo URL。但它抛出错误:
pip install https://gitlab.com/<myprivate_repo_path>/-/archive/main/private-module.tar.gz
Collecting https://gitlab.com/<myprivate_repo_path>/-/archive/main/private-module.tar.gz
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='gitlab.com', port=443): Max retries exceeded with url: /users/sign_in (Caused by ResponseError('too many 503 error responses'))
虽然从公共仓库的压缩存档安装工作正常:
pip install https://gitlab.com/pycqa/flake8/-/archive/3.7.7/flake8-3.7.7.tar.gz
Collecting https://gitlab.com/pycqa/flake8/-/archive/3.7.7/flake8-3.7.7.tar.gz
Downloading https://gitlab.com/pycqa/flake8/-/archive/3.7.7/flake8-3.7.7.tar.gz
| 153 kB 328 kB/s
Collecting entrypoints<0.4.0,>=0.3.0
Downloading entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting pyflakes<2.2.0,>=2.1.0
Downloading pyflakes-2.1.1-py2.py3-none-any.whl (59 kB)
|████████████████████████████████| 59 kB 476 kB/s
Collecting pycodestyle<2.6.0,>=2.5.0
Downloading pycodestyle-2.5.0-py2.py3-none-any.whl (51 kB)
|████████████████████████████████| 51 kB 782 kB/s
Collecting mccabe<0.7.0,>=0.6.0
Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Using legacy 'setup.py install' for flake8, since package 'wheel' is not installed.
Installing collected packages: pyflakes, pycodestyle, mccabe, entrypoints, flake8
Running setup.py install for flake8 ... done
Successfully installed entrypoints-0.3 flake8-3.7.7 mccabe-0.6.1 pycodestyle-2.5.0 pyflakes-2.1.1
我有什么办法仍然可以通过提供压缩存档 URL 从私人仓库 pip install 吗?
我已经尝试过了:
- 通过关注this URL 在 GitLab 中创建了一个令牌
- 在 URL 中使用了该令牌:
pip install https://<user>:<pass>@gitlab.com/<myprivate_repo_path>/-/archive/main/private-module.tar.gz
但它导致了同样的错误:
ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='gitlab.com', port=443): Max retries exceeded with url: /users/sign_in (Caused by ResponseError('too many 503 error responses'))
注意:
我不是在寻找类似下面的东西, 因为它增加了安装 git 的额外依赖项(尤其是在使用 docker 时)+ 我的要求是从压缩存档中安装模块。
pip install git+https://<user>:<pass>@gitlab.com/<myprivate_repo_path>/private-module.git
【问题讨论】: