Vertex AI installation

54 Views Asked by At

my python won't recognize vertexai. I followed this documentation: https://cloud.google.com/python/docs/reference/aiplatform/latest

BUT my pc doesn't recognize aiplatforms when running from google.cloud import aiplatform.

I tried reinstalling and upgrading, but it keeps saying "Cannot find reference 'aiplatform' in 'imported module google.cloud'".

ANY HELP IS APPRECIATED

Installing the packages following vertexai documentation.

1

There are 1 best solutions below

11
On

If you followed the documentation you linked here then first make sure you've activated your virtual environment as described in that doc.

aiplatform hast to be pip-installed. You should be able to install ai platform with the following (source): pip install "google-cloud-aiplatform>=1.38" or if you want to just get the latest pip install "google-cloud-aiplatform"

[Edit] This is how to include ImageGenerationModel: from vertexai.preview.vision_models import ImageGenerationModel

[Edit] You'll have to authenticate before using You could login via !gcloud auth login or if you're running this in jupyter or google-colab-notebook use

    from google.colab import auth
    auth.authenticate_user()

Can you share the error you're getting?