Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error with "import vertexai"

Hi,

I'm trying to use GCP: Vertex Ai. I already installed the Vertex AI SDK for Python package successfully.

I can "from google.cloud import aiplatform" successfully. However, "import vertexai" caused error as follows: No module named 'vertexai'

I also already installed the module vertexai in the linux machine successfully.

Would you help to show me what caused the error? Thanks so much in advance.

2 4 31.6K
4 REPLIES 4

Good day @tln888111 ,

Welcome to Google Cloud Community!

After you have installed the Vertex AI SDK, the Vertex AI client library is already installed. For Python, the Vertex AI SDK uses google.cloud.aiplatform. You just need to use the code below to get access to the vertex AI SDK. 

from google.cloud import aiplatform

You can already initialize your vertex AI. You can check this sample code on how to initialize:  https://cloud.google.com/vertex-ai/docs/start/install-sdk#initialize-python-sdk

You can also check this sample code on how to cancel a data labeling jobs. 
https://cloud.google.com/vertex-ai/docs/samples/aiplatform-cancel-data-labeling-job-sample

Hope this helps!


Hi Kvandres

Thanks so much for your replying.

I would like to share with you that I already resolved the issue by upgrading the google-cloud-aiplatform already installed in the GCP deep learning image (GCP) that I used to create the deep learning server.

The current version is 1.24.0. I need to upgrade it to 1.25.0 that includes the module vertexai, using the command line: pip install --upgrade googlke-cloud-aiplatform.

Everything is good! I can import vertexai successfully.

Thanks so much for all your help.

Thuan Nguyen (ainewtechs)

i am receiving this error as well... I can't figure out why either 

It seems related to library wrong define or install . similar issue I found at this page
موقع قصة عشق