On September 15, 2026, all Cloud Composer 1 versions and versions 2.0.x of Cloud Composer 2 will reach their planned end of life. You will not be able to use environments with these versions. We recommend planning migration to Cloud Composer 3. Cloud Composer 2 versions 2.1.x and later are still supported and are not impacted by this change.
This page explains how to disable or enable internet access when installing
PyPI packages in your environment.
For information about installing packages and configuring custom sources
(such as a repository in your VPC network), see
Install Python dependencies.
If you want to enable access to your VPC network from an environment,
see Connect an environment to a VPC network. For
example, you can configure your VPC network so that your environment
can access the internet through it.
About the internet access when installing PyPI packages
By default, your Cloud Composer 3 environment
can access the internet when installing PyPI packages.
Packages can now be installed from both public and private sources at the
same time. This wasn't possible in Cloud Composer 2.
This environment configuration option is independent of the environment's
networking type (Private or Public IP). For example, you can install
packages from Python Package Index in a
Private IP environment.
You can set this configuration option when you
create an environment and it's possible to change this option
for an existing environment.
Disable or enable internet access when installing PyPI packages
Console
In the Google Cloud console, go to the Environments page.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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)."]]