Reputation: 2208
We are using a private GitLab Enterprise installation for storing Python modules as described in the article PyPI packages in the Package Registry
The following command was used inside containers to install the privately hosted packages:
pip install <package_name_01> <package_name_02> \
--index-url https://<personal_access_token_name_package_01>:<personal_access_token_package_01>@gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple \
--extra-index-url https://<personal_access_token_name_package_02>:<personal_access_token_package_02>@gitlab.example.com/api/v4/projects/<project_id_package_02>/packages/pypi/simple
As seen in the example, we use packages from different GitLab projects. Therefore, we had to specify each GitLab project as --index-url
and --extra-index-url
. The showed solution was working but since a few days, we receive the following error:
pip install <package_name_01> <package_name_02> \
> --index-url https://<personal_access_token_name_package_01>:<personal_access_token_package_01>@gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple \
> --extra-index-url https://<personal_access_token_name_package_02>:<personal_access_token_package_02>@gitlab.example.com/api/v4/projects/<project_id_package_02>/packages/pypi/simple
Looking in indexes: https://<personal_access_token_name_package_01>:****@gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple, https://<personal_access_token_name_package_02>:****@gitlab.example.com/api/v4/projects/<project_id_package_02>/packages/pypi/simple
Collecting <package_name_01>
ERROR: HTTP error 404 while getting https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/files/55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX/<package_name_01>-0.0.18-py3-none-any.whl#sha256=55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX (from https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple/<package_name_01>/) (requires-python:>=3.6)
ERROR: Could not install requirement <package_name_01>==0.0.18 from https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/files/55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX/<package_name_01>-0.0.18-py3-none-any.whl#sha256=55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX because of HTTP error 404 Client Error: Not Found for url: https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/files/55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX/<package_name_01>-0.0.18-py3-none-any.whl for URL https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/files/55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX/<package_name_01>-0.0.18-py3-none-any.whl#sha256=55a5d545c01aee6ef5488cb18f9d19eee9d79XXXXXXX (from https://gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple/<package_name_01>/) (requires-python:>=3.6)
Installing the modules separately works however...
pip install <package_name_01> --index-url https://<personal_access_token_name_package_01>:<personal_access_token_package_01>@gitlab.example.com/api/v4/projects/<project_id_package_01>/packages/pypi/simple
pip install <package_name_02> --index-url https://<personal_access_token_name_package_02>:<personal_access_token_package_02>@gitlab.example.com/api/v4/projects/<project_id_package_02>/packages/pypi/simple
Does anyone have an idea what goes wrong here?
Upvotes: 1
Views: 8802
Reputation: 998
This is fixed in pip
as of version 23.1. See https://github.com/pypa/pip/issues/10902#issuecomment-1792415703.
I haven't tested exactly your example but I've successfully configured several extra indices with different tokens.
pip install \
--extra-index-url https://user1:[email protected]/api/v4/projects/12345/packages/pypi/simple \
--extra-index-url https://user2:[email protected]/api/v4/projects/23456/packages/pypi/simple \
--extra-index-url https://user3:[email protected]/api/v4/projects/34567/packages/pypi/simple \
package3
This will install package3
from the third private registry and package1
and package2
from the first and second private registries using different credentials for each.
Upvotes: 1
Reputation: 63
This is a bug in GitLab, wich needs to be resolved in the future.
Link to the official GitLab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/371814
Upvotes: 2