Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Gérer votre environnement Conda
Cette page explique comment gérer un environnement Conda dans votre instance Vertex AI Workbench.
Présentation
Si vous avez ajouté un environnement Conda à votre instance Vertex AI Workbench, il apparaît en tant que kernel dans l'interface JupyterLab de votre instance.
Vous avez peut-être ajouté un environnement Conda à votre instance pour utiliser un kernel qui n'est pas disponible dans une instance Vertex AI Workbench par défaut.
Cette page explique comment modifier et supprimer ce noyau.
Ouvrir JupyterLab
Dans la console Google Cloud, accédez à la page Instances.
À côté du nom de votre instance Vertex AI Workbench, cliquez sur Ouvrir JupyterLab.
Votre instance Vertex AI Workbench ouvre JupyterLab.
Modifier un kernel Conda
Les instances Vertex AI Workbench sont fournies avec des frameworks préinstallés tels que PyTorch et TensorFlow. Si vous avez besoin d'une autre version, vous pouvez modifier les bibliothèques à l'aide de pip dans l'environnement Conda approprié.
Par exemple, si vous souhaitez mettre à niveau PyTorch, procédez comme suit:
# Check the name of the conda environment for PyTorchcondaenvlist# Activate the environment for PyTorchcondaactivatepytorch# Display the PyTorch versionpython-c"import torch; print(torch.__version__)"# Make sure to use pip from the conda environment for PyTorch# This should be `/opt/conda/envs/pytorch/bin/pip`whichpip# Upgrade PyTorchpipinstall--upgradetorch
Supprimer un kernel Conda
Certains packages Conda ajoutent des kernels par défaut à votre environnement lors de leur installation. Par exemple, lorsque vous installez R, Conda peut également ajouter un kernel python3. Cela peut entraîner une duplication de kernels dans votre environnement. Pour éviter la duplication de kernels, supprimez le kernel par défaut avant de créer un autre kernel portant le même nom.
Pour diagnostiquer et résoudre les problèmes liés à la gestion d'un environnement Conda dans votre instance Vertex AI Workbench, consultez la page Résoudre les problèmes liés à Vertex AI Workbench.
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,["# Manage the conda environment in your Vertex AI Workbench instance\n\nManage your conda environment\n=============================\n\nThis page describes how to manage a conda environment in your\nVertex AI Workbench instance.\n\nOverview\n--------\n\nIf you've added a conda environment to your Vertex AI Workbench instance,\nit appears as a\n[kernel](https://jupyterlab.readthedocs.io/en/stable/user/documents_kernels.html)\nin your instance's JupyterLab interface.\n\nYou might have added a conda environment to your instance to use a kernel\nthat isn't available in a default Vertex AI Workbench instance.\nThis page describes how to modify and delete that kernel.\n\nOpen JupyterLab\n---------------\n\n1. In the Google Cloud console, go to the **Instances** page.\n\n [Go to Instances](https://console.cloud.google.com/vertex-ai/workbench/instances)\n2. Next to your Vertex AI Workbench instance's name,\n click **Open JupyterLab**.\n\n Your Vertex AI Workbench instance opens JupyterLab.\n\nModify a conda kernel\n---------------------\n\nVertex AI Workbench instances come with pre-installed frameworks such as PyTorch\nand TensorFlow. If you need a different version, you can modify the\nlibraries by using pip in the relevant conda environment.\n\nFor example, if you want to upgrade PyTorch: \n\n```python\n# Check the name of the conda environment for PyTorch\nconda env list\n\n# Activate the environment for PyTorch\nconda activate pytorch\n\n# Display the PyTorch version\npython -c \"import torch; print(torch.__version__)\"\n\n# Make sure to use pip from the conda environment for PyTorch\n# This should be `/opt/conda/envs/pytorch/bin/pip`\nwhich pip\n\n# Upgrade PyTorch\npip install --upgrade torch\n```\n\nDelete a conda kernel\n---------------------\n\nSome conda packages add default kernels to your environment when the packages\nare installed. For example, when you install R, conda might also add a\n`python3` kernel. This can cause a duplication of kernels in your\nenvironment. To avoid duplicated kernels, delete the default kernel\nbefore you create a new kernel with the same name. \n\n```scdoc\nrm -rf /opt/conda/envs/CONDA_ENVIRONMENT_NAME/share/jupyter/kernels/python3\n```\n\nTroubleshoot\n------------\n\nTo diagnose and resolve issues related to managing a conda environment in\nyour Vertex AI Workbench instance, see [Troubleshooting\nVertex AI Workbench](/vertex-ai/docs/general/troubleshooting-workbench#instances).\n\nWhat's next\n-----------\n\n- Learn more about [conda](https://docs.conda.io/en/latest/)."]]