That error is not about your Python code — it’s a permissions / API enablement issue in Google Cloud. Even if you are “Admin” in the project, Vertex AI needs the right APIs and service accounts enabled before a custom training job can run.
Things to check
1. Enable the Vertex AI API
Go to Google Cloud Console → APIs & Services → Library and ensure:
• Vertex AI API (aiplatform.googleapis.com) is enabled.
• Cloud Storage API is also enabled (training jobs use GCS for staging).
2. Check the service account used for training
• By default, Vertex AI custom training runs under the Compute Engine default service account or a custom one you specify.
• That service account needs roles like:
• Vertex AI Administrator (roles/aiplatform.admin)
• Storage Admin (roles/storage.admin) or at least Storage Object Admin on your GCS bucket.