Am 15. September 2026erreichen alle Cloud Composer 1- und Cloud Composer 2-Umgebungen der Version 2.0.x das geplante Ende des Lebenszyklus und können nicht mehr verwendet werden. Wir empfehlen, die Migration zu Cloud Composer 3 zu planen.
Auf dieser Seite wird beschrieben, wie Sie den Internetzugriff deaktivieren oder aktivieren, wenn Sie PyPI-Pakete in Ihrer Umgebung installieren.
Informationen zum Installieren von Paketen und Konfigurieren benutzerdefinierter Quellen (z. B. eines Repositories in Ihrem VPC-Netzwerk) finden Sie unter Python-Abhängigkeiten installieren.
Wenn Sie den Zugriff auf Ihr VPC-Netzwerk von einer Umgebung aus aktivieren möchten, lesen Sie den Hilfeartikel Umgebung mit einem VPC-Netzwerk verbinden. Sie können Ihr VPC-Netzwerk beispielsweise so konfigurieren, dass Ihre Umgebung über das Netzwerk auf das Internet zugreifen kann.
Internetzugriff bei der Installation von PyPI-Paketen
Standardmäßig kann Ihre Cloud Composer 3-Umgebung bei der Installation von PyPI-Paketen auf das Internet zugreifen.
Pakete können jetzt gleichzeitig aus öffentlichen und privaten Quellen installiert werden. In Cloud Composer 2 war das nicht möglich.
Diese Option für die Umgebungskonfiguration ist unabhängig vom Netzwerktyp der Umgebung (private oder öffentliche IP-Adresse). Sie können beispielsweise Pakete aus dem Python-Paketindex in einer privaten IP-Umgebung installieren.
Sie können diese Konfigurationsoption beim Erstellen einer Umgebung festlegen. Sie lässt sich auch für eine vorhandene Umgebung ändern.
Internetzugriff bei der Installation von PyPI-Paketen deaktivieren oder aktivieren
Console
Rufen Sie in der Google Cloud -Console die Seite Umgebungen auf.
[[["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-26 (UTC)."],[[["\u003cp\u003eCloud Composer 3 environments, by default, have internet access enabled for installing PyPI packages, allowing them to be installed from both public and private sources.\u003c/p\u003e\n"],["\u003cp\u003eInternet access for installing PyPI packages can be toggled on or off regardless of whether the environment uses a Private or Public IP network.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable or disable internet access during environment creation or modify the setting for existing Cloud Composer 3 environments.\u003c/p\u003e\n"],["\u003cp\u003eThe internet access setting can be configured through the Google Cloud console, gcloud CLI, API, or Terraform, using the \u003ccode\u003eenable_private_builds_only\u003c/code\u003e parameter or \u003ccode\u003eAccess to public PyPI package repositories\u003c/code\u003e option.\u003c/p\u003e\n"]]],[],null,["# Configure access to the internet when installing PyPI packages\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n**Cloud Composer 3** \\| Cloud Composer 2 \\| Cloud Composer 1\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page explains how to disable or enable internet access when installing\nPyPI packages in your environment.\n\nFor information about installing packages and configuring custom sources\n(such as a repository in your VPC network), see\n[Install Python dependencies](/composer/docs/composer-3/install-python-dependencies).\n\nIf you want to enable access to your VPC network from an environment,\nsee [Connect an environment to a VPC network](/composer/docs/composer-3/connect-vpc-network). For\nexample, you can configure your VPC network so that your environment\ncan access the internet through it.\n\nIf you want to change your environment to Private IP, see\n[Change environment networking type (Private or Public IP)](/composer/docs/composer-3/change-networking-type).\n\nAbout the internet access when installing PyPI packages\n-------------------------------------------------------\n\n- By default, your Cloud Composer 3 environment\n **can access the internet when installing PyPI packages**.\n\n- Packages can now be installed from both public and private sources at the\n same time. This wasn't possible in Cloud Composer 2.\n\n- This environment configuration option is independent of the environment's\n networking type (Private or Public IP). For example, you can install\n packages from [Python Package Index](https://pypi.org) in a\n Private IP environment.\n\n- You can set this configuration option when you\n [create an environment](/composer/docs/composer-3/create-environments) and it's possible to change this option\n for an existing environment.\n\nDisable or enable internet access when installing PyPI packages\n---------------------------------------------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Environments** page.\n\n [Go to Environments](https://console.cloud.google.com/composer/environments)\n2. In the list of environments, click the name of your environment.\n The **Environment details** page opens.\n\n3. Go to the **Environment configuration** tab.\n\n4. In the **Network configuration** section, find the\n **Access to public PyPI package repositories** item and click **Edit**.\n\n5. In the **Access to public PyPI package repositories** dialog:\n\n - To enable internet access, select\n **Allow installation of packages from public internet repositories**.\n\n - To disable internet access, select\n **Don't allow installation of packages from public internet repositories**.\n\n6. Click **Save**.\n\n### gcloud\n\nThe following Google Cloud CLI arguments specify internet access\nconfiguration when installing PyPI packages:\n\n- `--disable-private-builds-only` **enables** internet access when installing\n packages (default).\n\n- `--enable-private-builds-only` **disables** internet access when installing\n packages.\n\nTo enable internet access when installing packages, run the following\nGoogle Cloud CLI command: \n\n gcloud beta composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --disable-private-builds-only\n\nTo disable internet access when installing packages, run the following\nGoogle Cloud CLI command: \n\n gcloud beta composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --enable-private-builds-only\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of the environment\n- `LOCATION`: the region where the environment is located\n\nExample (disable internet access): \n\n gcloud beta composer environments update example-environment \\\n --location us-central1 \\\n --enable-private-builds-only\n\n### API\n\n1. Create an [`environments.patch`](/composer/docs/reference/rest/v1beta1/projects.locations.environments/patch) API request.\n\n2. In this request:\n\n 1. In the `updateMask` parameter, specify\n the `config.private_environment_config.enable_private_builds_only`\n mask.\n\n 2. In the request body, in the `enablePrivateBuildsOnly` field, set the\n required value:\n\n - `false`: enable internet access when installing PyPI packages (default).\n - `true`: disable internet access when installing PyPI packages.\n\nExample (disable internet access): \n\n // PATCH https://composer.googleapis.com/v1beta1/projects/example-project/\n // locations/us-central1/environments/example-environment?updateMask=\n // config.private_environment_config.enable_private_builds_only\n\n \"config\": {\n \"privateEnvironmentConfig\": {\n \"enablePrivateBuildsOnly\": true\n }\n }\n\n### Terraform\n\nThe `enable_private_builds_only` field in the `config` block specifies\ninternet access configuration when installing PyPI packages:\n\n- `false` or omitted: **enables** internet access when installing\n packages (default).\n\n- `true`: **disables** internet access when installing packages.\n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\"\n region = \"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\"\n\n config {\n enable_private_builds_only = \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-err\"\u003ePRIVATE_BUILDS_MODE\u003c/span\u003e\u003c/var\u003e\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n- `PRIVATE_BUILDS_MODE`: whether the internet access is disabled when installing PyPI packages.\n\nExample (disable internet access): \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"example-environment\"\n region = \"us-central1\"\n\n config {\n\n enable_private_builds_only = true\n\n ... other configuration parameters\n\n }\n\nWhat's next\n-----------\n\n- [Install Python dependencies](/composer/docs/composer-3/install-python-dependencies)\n- [Connect an environment to a VPC network](/composer/docs/composer-3/connect-vpc-network)\n- [Change environment networking type (Private or Public IP)](/composer/docs/composer-3/change-networking-type)."]]