Il 15 settembre 2026, tutti gli ambienti Cloud Composer 1 e Cloud Composer 2 versione 2.0.x raggiungeranno la fine del ciclo di vita pianificata e non potrai più utilizzarli. Ti consigliamo di pianificare la migrazione a Cloud Composer 3.
Questa pagina spiega come disattivare o attivare l'accesso a internet durante l'installazione di pacchetti PyPI nel tuo ambiente.
Per informazioni sull'installazione dei pacchetti e sulla configurazione delle origini personalizzate (ad esempio un repository nella tua rete VPC), consulta Installare le dipendenze Python.
Se vuoi attivare l'accesso alla tua rete VPC da un ambiente, consulta Connetti un ambiente a una rete VPC. Ad esempio, puoi configurare la rete VPC in modo che il tuo ambiente possa accedere a internet tramite questa rete.
Informazioni sull'accesso a internet durante l'installazione dei pacchetti PyPI
Per impostazione predefinita, l'ambiente Cloud Composer 3
può accedere a internet durante l'installazione dei pacchetti PyPI.
Ora i pacchetti possono essere installati contemporaneamente da origini pubbliche e private. Ciò non era possibile in Cloud Composer 2.
Questa opzione di configurazione dell'ambiente è indipendente dal tipo di rete dell'ambiente (IP privato o pubblico). Ad esempio, puoi installare i pacchetti del Python Package Index in un ambiente IP privato.
Puoi impostare questa opzione di configurazione quando
crei un ambiente ed è possibile modificarla
per un ambiente esistente.
Disattivare o attivare l'accesso a internet durante l'installazione dei pacchetti PyPI
Console
Nella Google Cloud console, vai alla pagina Ambienti.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-08-29 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,["\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- 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\nConsole\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\ngcloud\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\nAPI\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\nTerraform\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- [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)."]]