Stay organized with collections
Save and categorize content based on your preferences.
Use the Vertex AI SDK for Python to automate your machine learning (ML) workflows.
This topic shows you how to install the Vertex AI SDK for Python. For more
information about the Vertex AI SDK, see the following resources:
A Python best practice is to install the Vertex AI SDK in an
isolated Python environment for each project. This helps prevent dependency,
version, and permissions conflicts. You can create an isolated environment for
using the command line in a shell or for using a notebook.
To use a notebook in an isolated environment, you can create a
Vertex AI Workbench instance. Then, install the Vertex AI SDK
and run your Python scripts from a notebook on your Vertex AI Workbench instance.
For more information, see
Create a Vertex AI Workbench instance.
Install or update the Vertex AI SDK package
To install or update the Vertex AI SDK, run the following command in your
virtual environment:
pip install --upgrade google-cloud-aiplatform
Initialize the Vertex AI SDK
After you install the Vertex AI SDK for Python, you must initialize the SDK with
your Vertex AI and Google Cloud details. For example, when you
initialize the SDK, you specify information such as your project name, region,
and your staging Cloud Storage bucket. The following method is an example of
a method that initializes the Vertex AI SDK.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Install the Vertex AI SDK for Python\n\nUse the Vertex AI SDK for Python to automate your machine learning (ML) workflows.\nThis topic shows you how to install the Vertex AI SDK for Python. For more\ninformation about the Vertex AI SDK, see the following resources:\n\n- To learn about the Vertex AI SDK for Python, see [Introduction to the Vertex AI SDK for Python](/vertex-ai/docs/python-sdk/use-vertex-ai-python-sdk).\n- To learn how to train a model using the Vertex AI SDK for Python, see the [Train\n a model using Vertex AI and the Python\n SDK](/vertex-ai/docs/tutorials/tabular-bq-prediction).\n- To learn about the classes and methods in the Vertex AI SDK for Python, see the [Vertex AI SDK reference](/python/docs/reference/aiplatform/latest/google.cloud.aiplatform).\n\nInstallation of the Vertex AI SDK for Python includes the following steps:\n\n1. [Create an isolated Python environment](#create-isolated-environment)\n2. [Install the Vertex AI SDK package](#install-python-sdk)\n3. [Initialize the Vertex AI SDK](#initialize-python-sdk)\n\nCreate an isolated Python environment\n-------------------------------------\n\nA Python best practice is to install the Vertex AI SDK in an\nisolated Python environment for each project. This helps prevent dependency,\nversion, and permissions conflicts. You can create an isolated environment for\nusing the command line in a shell or for using a notebook.\n\nTo create an isolated environment when you use the command line, [activate a\n`venv` environment](/python/docs/setup#installing_and_using_virtualenv). After\nthe `venv` environment is activated, you're ready to install the\nVertex AI SDK and run your Python scripts. For more information, see\n[Use `venv` to isolate dependencies](/python/docs/setup#installing_and_using_virtualenv)\nand [Set up a Python development environment](/python/docs/setup).\n\nTo use a notebook in an isolated environment, you can create a\nVertex AI Workbench instance. Then, install the Vertex AI SDK\nand run your Python scripts from a notebook on your Vertex AI Workbench instance.\nFor more information, see\n[Create a Vertex AI Workbench instance](/vertex-ai/docs/workbench/instances/create).\n\nInstall or update the Vertex AI SDK package\n-------------------------------------------\n\nTo install or update the Vertex AI SDK, run the following command in your\nvirtual environment: \n\n```\npip install --upgrade google-cloud-aiplatform\n```\n\nInitialize the Vertex AI SDK\n----------------------------\n\nAfter you install the Vertex AI SDK for Python, you must initialize the SDK with\nyour Vertex AI and Google Cloud details. For example, when you\ninitialize the SDK, you specify information such as your project name, region,\nand your staging Cloud Storage bucket. The following method is an example of\na method that initializes the Vertex AI SDK. \n\n def init_sample(\n project: Optional[str] = None,\n location: Optional[str] = None,\n experiment: Optional[str] = None,\n staging_bucket: Optional[str] = None,\n credentials: Optional[google.auth.credentials.Credentials] = None,\n encryption_spec_key_name: Optional[str] = None,\n service_account: Optional[str] = None,\n ):\n\n import https://cloud.google.com/python/docs/reference/vertexai/latest/\n\n https://cloud.google.com/python/docs/reference/vertexai/latest/.init(\n project=project,\n location=location,\n experiment=experiment,\n staging_bucket=staging_bucket,\n credentials=credentials,\n encryption_spec_key_name=encryption_spec_key_name,\n service_account=service_account,\n )\n\nWhat's next\n-----------\n\n- Learn more about the [Vertex AI SDK](/vertex-ai/docs/python-sdk/use-vertex-ai-python-sdk)."]]