googleapis / googleapis/python-aiplatform

Inconsistent GOOGLE_CLOUD_PROJECT env variable

Open
#5,392 0 comments 0 reactions 0 assignees View on GitHub
api: vertex-ai
Dominant language
Python
Stars
905
Forks
465
Avg merge
1d 13h
Merged PRs (30d)
44

Description

Currently in the [google/cloud/aiplatform/initializer.py#L92](https://github.com/googleapis/python-aiplatform/blob/c81eb7219631e58c6002a7aff8905545bda1132a/google/cloud/aiplatform/initializer.py#L92) we expect GOOGLE_CLOUD_PROJECT variable to be set to project number (and we try to convert it to project Id further).

But [google.auth.default()](https://github.com/googleapis/google-auth-library-python/blob/main/google/auth/_default.py) we rely on everywhere actually expects GOOGLE_CLOUD_PROJECT to be set to project Id already.

So having that env variable set gives wrong values for [project property](https://github.com/googleapis/python-aiplatform/blob/c81eb7219631e58c6002a7aff8905545bda1132a/google/cloud/aiplatform/initializer.py#L350) from initialized context.

This can probably have side effects on the code dependent on this library, but we can either introduce another env variable for project number, or remove the [code trying to convert it to project Id](https://github.com/googleapis/python-aiplatform/blob/c81eb7219631e58c6002a7aff8905545bda1132a/google/cloud/aiplatform/initializer.py#L101).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.