While deploying a gen2 Cloud Function the following cloud build is unable to fetch any python packages (public and/or private).
The cloud build service account that gets used has the necessary Artifact Registry roles (Writer, Reader).
Both projects are also a part of a Shared VPC and the requirements.txt file contains
"--index-url https://europe-west1-python.pkg.dev/<other-project-name>/virtual-pypi/simple".
```
ERROR: Could not find a version that satisfies the requirement pydantic==2.* (from versions: none)
```
And other private packages also fail.
Any suggestions are welcomed!
Hi @jcraps,
Welcome to Google Cloud Community!
The error message you are encountering indicates that your Cloud Build environment can't find a compatible version of the pydantic library (specifically within the major version 2 range). This is likely due to a combination of factors related to how you're configuring your build environment and how you're accessing packages.
Here are some suggestions that might help resolve the issue you're encountering:
cloudbuild.yaml
that specifies an exact version of 'pydantic':steps:
- name: 'python:3.9'
entrypoint: pip
args:
- install
- pydantic==2.8.2
- ...
Note: Replace '2.8.2' with an exact version that you verified exists on PyPI. This ensures that Cloud Build can find a specific version that matches your requirement.
steps:
- name: 'python:3.9' # Or your preferred Python version
entrypoint: 'bash'
args:
- '-c'
- |
# Upgrade pip first
pip install --upgrade pip
# Upgrade setuptools
pip install --upgrade setuptools
I hope the above information is helpful for you.