I am trying to install a package via pip as part of my github CI/CD but facing issues. I successfully published my package on the artifact registry. I can see it when i run
gcloud artifacts versions list --package=PACKAGE
I have given access to the registry for the identity pool with
gcloud artifacts repositories add-iam-policy-binding PACKAGE_NAME \
--location=europe-west9 --member="principalSet://iam.googleapis.com/${WORKLOAD_IDENTITY_POOL_ID}/attribute.repository/${REPO}" --role=roles/artifactregistry.admin
The setup of the identity pool should be fine since github is able to access other resources (in my case pub sub)
But the workflow fails with
pip install --index-url https://europe-west9-python.pkg.dev/path-to/simple/ PACKAGE
with the error below
Looking in indexes: https://europe-west9-python.pkg.dev/ynstant-dev/ynstant-utils/simple/
ERROR: Exception:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
return func(self, options, args)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 377, in run
requirement_set = resolver.resolve(
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 95, in resolve
result = self._result = resolver.resolve(
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__
return bool(self._sequence)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 44, in _iter_built
for version, func in infos:
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 297, in iter_index_candidate_infos
result = self._finder.find_best_candidate(
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 890, in find_best_candidate
candidates = self.find_all_candidates(project_name)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 831, in find_all_candidates
page_candidates = list(page_candidates_it)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/sources.py", line 194, in page_candidates
yield from self._candidates_from_page(self._link)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/package_finder.py", line 791, in process_project_url
index_response = self._link_collector.fetch_response(project_url)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 461, in fetch_response
return _get_index_content(location, session=self.session)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 364, in _get_index_content
resp = _get_simple_response(url, session=session)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/index/collector.py", line 135, in _get_simple_response
resp = session.get(
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/network/session.py", line 520, in request
return super().request(method, url, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/requests/sessions.py", line 710, in send
r = dispatch_hook("response", hooks, r, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_vendor/requests/hooks.py", line 30, in dispatch_hook
_hook_data = hook(hook_data, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/network/auth.py", line 500, in handle_401
username, password, save = self._prompt_for_password(parsed.netloc)
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/network/auth.py", line 455, in _prompt_for_password
username = ask_input(f"User for {netloc}: ") if self.prompting else None
File "/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pip/_internal/utils/misc.py", line 251, in ask_input
return input(message)
EOFError: EOF when reading a line
User for europe-west9-python.pkg.dev:
Error: Process completed with exit code 2.
I am able to run this command from my terminal and it install the package fine. What am i missing?
As suggested in this Github Link Can you try particularly giving the
packages_to_installtag like below:Also based on your logs
Can you try to install a pip package from Artifact Registry and to work with the workflow, Try with the below steps:
cat service-account.json | base64pip.confto/config/pip/pip.confin Composer GCS bucketNote: Contents of this file as it is mentioned in Documentation, where KEY is a string generated on a step #5.
Please also have a look at this Stackoverflow Link.