Erreurs lors de l'importation du SDK Vertex AI pour Python
Si vous ne parvenez pas à importer le SDK Vertex AI pour Python, cela peut être dû à l'un des problèmes suivants :
Version obsolète du SDK Vertex AI pour Python
Problème :
Vous recevez un message d'erreur semblable à celui-ci :
ImportError: cannot import name 'reasoning_engines' from 'vertexai.preview'
Cause possible :
Cela peut se produire si la version de votre package google-cloud-aiplatform est antérieure à 1.47.0. Pour vérifier la version de votre package google-cloud-aiplatform, exécutez la commande suivante dans le terminal :
pipshowgoogle-cloud-aiplatform
Solution recommandée :
Exécutez la commande suivante dans votre terminal pour mettre à jour votre package google-cloud-aiplatform :
pipinstallgoogle-cloud-aiplatform--upgrade
Vérifiez que votre version mise à jour est 1.47.0 ou ultérieure en exécutant la commande suivante :
pipshowgoogle-cloud-aiplatform
Si vous vous trouvez dans une instance de notebook (par exemple, Jupyter, Colab ou Workbench), vous devrez peut-être redémarrer votre environnement d'exécution pour utiliser les packages mis à jour.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["# Troubleshoot setting up an environment\n\nThis document describes how to resolve errors that you might encounter when\n[setting up an environment](/vertex-ai/generative-ai/docs/agent-engine/set-up).\n\nErrors when importing the Vertex AI SDK for Python\n--------------------------------------------------\n\nIf you can't import the Vertex AI SDK for Python, it might be caused by one of the\nfollowing issues:\n\n### Outdated version of the Vertex AI SDK for Python\n\n**Issue**:\n\nYou receive an error message similar to the following: \n\n ImportError: cannot import name 'reasoning_engines' from 'vertexai.preview'\n\nor \n\n ImportError: cannot import name 'agent_angines' from 'vertexai'\n\n**Possible cause**:\n\nThis might happen if the version of your `google-cloud-aiplatform` package\nis earlier than `1.82.0` (for `agent_engines`) or `1.47.0`\n(for `reasoning_engines`). To check the version of your `google-cloud-aiplatform`\npackage, run the following command in the terminal: \n\n pip show google-cloud-aiplatform\n\n**Recommended solution**:\n\nRun the following command in your terminal to update your\n`google-cloud-aiplatform` package: \n\n pip install google-cloud-aiplatform --upgrade\n\nVerify your updated version is `1.82.0` or later by running the following command: \n\n pip show google-cloud-aiplatform\n\nIf you're in a notebook instance (For example, Jupyter or Colab or Workbench),\nyou might need to restart your runtime to use the updated packages."]]