Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menambahkan lingkungan conda
Halaman ini menjelaskan cara menambahkan lingkungan conda ke
instance Vertex AI Workbench.
Ringkasan
Saat Anda menambahkan lingkungan conda ke
instance Vertex AI Workbench, lingkungan tersebut akan muncul sebagai
kernel
di antarmuka JupyterLab instance Anda.
Anda dapat menambahkan lingkungan conda ke instance Vertex AI Workbench
untuk menggunakan kernel yang tidak tersedia di instance Vertex AI Workbench.
Misalnya, Anda dapat menambahkan lingkungan conda untuk R dan Apache Beam. Atau, Anda
dapat menambahkan lingkungan conda untuk versi lama tertentu dari framework
yang tersedia, seperti TensorFlow, PyTorch, atau Python.
Kernel tercantum di antara yang lain di jendela Peluncur.
Secara default, conda dapat menggunakan paket pip di folder pip sistem
(misalnya, /usr/bin/pip). Menjalankan conda install pip memastikan bahwa
penyiapan menggunakan pip lokal untuk lingkungan.
Contoh penginstalan: R Essentials
Contoh berikut menginstal R Essentials di lingkungan conda bernama r.
conda create -n r
conda activate r
conda install -c r r-essentials
Contoh penginstalan: paket pip
Contoh berikut menginstal paket pip dari file requirements.txt.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]