Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Conda-Umgebung hinzufügen
Auf dieser Seite wird beschrieben, wie Sie der Vertex AI Workbench-Instanz eine Conda-Umgebung hinzufügen.
Übersicht
Wenn Sie Ihrer Vertex AI Workbench-Instanz eine Conda-Umgebung hinzufügen, wird sie in der JupyterLab-Benutzeroberfläche Ihrer Instanz als Kernel angezeigt.
Sie können Ihrer Vertex AI Workbench-Instanz eine Conda-Umgebung hinzufügen, um Kernel zu verwenden, die in Vertex AI Workbench-Instanzen nicht verfügbar sind.
Sie können beispielsweise Conda-Umgebungen für R und Apache Beam hinzufügen. Oder Sie können Conda-Umgebungen für bestimmte ältere Versionen der verfügbaren Frameworks wie TensorFlow, PyTorch oder Python hinzufügen.
CONDA_ENVIRONMENT_NAME: der gewünschte Name für die Umgebung
PACKAGE: das Paket, das Sie installieren möchten
KERNEL_DISPLAY_NAME: Der Anzeigename für die Kachel des Kernels in der JupyterLab-Benutzeroberfläche
Ein Standardkernel kann beim Installieren in einer bestimmten Conda-Umgebung erstellt werden. Sie können den Standardkernel mit dem folgenden Befehl entfernen:
Der Kernel wird im Fenster Launcher neben den anderen aufgelistet.
Standardmäßig verwendet conda möglicherweise pip-Pakete im Systemordner pip (z. B. /usr/bin/pip). Wenn Sie conda install pip ausführen, wird für die Einrichtung ein in der Umgebung lokaler pip verwendet.
Beispielinstallation: R Essentials
Im folgenden Beispiel wird R Essentials in einer Conda-Umgebung mit dem Namen r installiert.
conda create -n r
conda activate r
conda install -c r r-essentials
Beispielinstallation: Pip-Paket
Im folgenden Beispiel werden Pip-Pakete aus einer requirements.txt-Datei installiert.
Informationen zur Diagnose und Behebung von Problemen im Zusammenhang mit dem Hinzufügen einer Conda-Umgebung finden Sie unter Fehlerbehebung bei Vertex AI Workbench.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 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)."]]