401 Nicht autorisiert bei der Installation des Python-Pakets aus der Artifacts-Registrierung für Google BuildPython

Python-Programme
Guest
 401 Nicht autorisiert bei der Installation des Python-Pakets aus der Artifacts-Registrierung für Google Build

Post by Guest »

Was ich versuche
Ich versuche, ein Docker-Image in Google Build zu erstellen, das ein Python-Paket erfordert, das in Artifacts Registry gespeichert ist. Ich verwende uv als Paketmanager.
Hier ist meine Docker-Datei für das Image:

Code: Select all

FROM python:3.12.2-slim-bookworm

ENV UV_COMPILE_BYTECODE=1
ENV G_PROJECT_ID=...
ENV G_LOCATION=...
ENV G_PY_REPOSITORY=...

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ADD . /app
WORKDIR /app

RUN uv sync --frozen

RUN uv pip install keyrings.google-artifactregistry-auth
RUN uv pip install --extra-index-url https://$G_LOCATION-python.pkg.dev/$G_PROJECT_ID/$G_PY_REPOSITORY/simple/ my-package --verbose
Problem
Bei Schritt uv pip install --extra-index-url erhalte ich 401 Nicht autorisiert, was ist irgendwie erwartet, aber ich kann nicht herausfinden, wie ich es tatsächlich autorisieren soll. Es scheint etwas zu sein, das sehr einfach zu machen sein sollte.
Hier ist ein Ausgabestück:

Code: Select all

DEBUG No compatible version found for: my-package
× No solution found when resolving dependencies:
╰─▶ Because utils-ms was not found in the package registry and you
require my-package, we can conclude that your requirements are
unsatisfiable.

hint: An index URL
(https://...-python.pkg.dev/.../.../simple/)
could not be queried due to a lack of valid authentication credentials
(401 Unauthorized).
DEBUG Released lock at `/app/.venv/.lock`
The command '/bin/sh -c uv pip install --extra-index-url https://$G_LOCATION-python.pkg.dev/$G_PROJECT_ID/$G_PY_REPOSITORY/simple/ my-package --verbose' returned a non-zero code: 1
Verwandte Fragen
Diese Frage deckt ein sehr ähnliches Problem ab, außer dass der Fehler sich von meinem unterscheidet.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post