Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Adicionar um ambiente conda
Nesta página, descrevemos como adicionar um ambiente conda à sua
instância do Vertex AI Workbench.
Informações gerais
Quando você adiciona um ambiente conda à
instância do Vertex AI Workbench, ele aparece como um
kernel
na interface do JupyterLab da instância.
É possível adicionar um ambiente conda à instância do
Vertex AI Workbench para usar kernels que não estão disponíveis nas instâncias do Vertex AI Workbench.
Por exemplo, é possível adicionar ambientes conda para R e Apache Beam. Ou adicione
ambientes conda para versões mais antigas específicas dos frameworks disponíveis,
como TensorFlow, PyTorch ou Python.
O kernel é listado entre os outros na janela Launcher.
Por padrão, o conda pode usar pacotes pip na pasta pip do sistema
(por exemplo, /usr/bin/pip). A execução de conda install pip garante que
a configuração use um pip local para o ambiente.
Exemplo de instalação: R Essentials
O exemplo a seguir instala o R Essentials em um ambiente conda chamado r.
conda create -n r
conda activate r
conda install -c r r-essentials
Exemplo de instalação: pacote pip
O exemplo a seguir instala pacotes pip de um arquivo requirements.txt.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-19 UTC."],[],[],null,["# Add a conda environment to a Vertex AI Workbench instance\n\nAdd a conda environment\n=======================\n\nThis page describes how to add a conda environment to your\nVertex AI Workbench instance.\n\nOverview\n--------\n\nWhen you add a conda environment to\nyour Vertex AI Workbench instance, it appears as a\n[kernel](https://jupyterlab.readthedocs.io/en/stable/user/documents_kernels.html)\nin your instance's JupyterLab interface.\n\nYou might add a conda environment to your Vertex AI Workbench instance\nto use kernels that aren't available in Vertex AI Workbench instances.\nFor example, you can add conda environments for R and Apache Beam. Or you\ncan add conda environments for specific older versions of the available\nframeworks, such as TensorFlow, PyTorch, or Python.\n\nBefore you begin\n----------------\n\nIf you haven't already,\n[create\na Vertex AI Workbench instance](/vertex-ai/docs/workbench/instances/create-console-quickstart).\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\nAdd a conda environment\n-----------------------\n\nYou can add a conda environment by entering commands in your instance's\nJupyterLab terminal.\n\n1. In JupyterLab,\n select **File \\\u003e New \\\u003e Terminal**.\n\n2. In the **Terminal** window, enter the following commands:\n\n ```genshi\n # Creates a conda environment.\n conda create -n CONDA_ENVIRONMENT_NAME -y\n conda activate CONDA_ENVIRONMENT_NAME\n\n # Install packages using a pip local to the conda environment.\n conda install pip\n pip install PACKAGE\n\n # Adds the conda kernel.\n DL_ANACONDA_ENV_HOME=\"${DL_ANACONDA_HOME}/envs/CONDA_ENVIRONMENT_NAME\"\n python -m ipykernel install --prefix \"${DL_ANACONDA_ENV_HOME}\" --name CONDA_ENVIRONMENT_NAME --display-name KERNEL_DISPLAY_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCONDA_ENVIRONMENT_NAME\u003c/var\u003e: your choice of name for the environment\n - \u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e: the package that you want to install\n - \u003cvar translate=\"no\"\u003eKERNEL_DISPLAY_NAME\u003c/var\u003e: the display name for the tile of the kernel in the JupyterLab interface\n3. A default kernel can be created when installing to a given\n conda environment. You can remove the default kernel with the\n following command:\n\n ```scdoc\n rm -rf \"/opt/micromamba/envs/CONDA_ENVIRONMENT_NAME/share/jupyter/kernels/python3\n ```\n4. To see your new kernel, do the following:\n\n 1. Refresh the page.\n\n 2. Select **File \\\u003e New Launcher**.\n\n The kernel is listed among the others in the **Launcher** window.\n\nBy default, conda might use pip packages in the system `pip` folder\n(for example, `/usr/bin/pip`). Running `conda install pip` ensures that\nthe setup uses a pip local to the environment.\n\nExample installation: R Essentials\n----------------------------------\n\nThe following example installs R Essentials in a conda environment named `r`. \n\n```text\nconda create -n r\nconda activate r\nconda install -c r r-essentials\n```\n\nExample installation: pip package\n---------------------------------\n\nThe following example installs pip packages from a `requirements.txt` file. \n\n```genshi\nconda create -n myenv\nconda activate myenv\nconda install pip\npip install -r requirements.txt\nDL_ANACONDA_ENV_HOME=\"${DL_ANACONDA_HOME}/envs/myenv\"\npython -m ipykernel install --prefix \"${DL_ANACONDA_ENV_HOME}\" --name myenv --display-name myenv\n```\n\nTroubleshoot\n------------\n\nTo diagnose and resolve issues related to adding a conda environment,\nsee [Troubleshooting\nVertex AI Workbench](/vertex-ai/docs/general/troubleshooting-workbench#pip-packages-missing-instances).\n\nWhat's next\n-----------\n\n- Learn more about [conda](https://docs.conda.io/en/latest/).\n\n- To modify your conda environment, see [Manage your conda\n environment](/vertex-ai/docs/workbench/instances/manage-environment)."]]