- Saved searches
- Use saved searches to filter your results more quickly
- License
- googleapis/google-cloud-python
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.rst
- Using the Google Cloud CLI installer
- Interactive installation
- Non-interactive (silent) deployment
- Try it for yourself
- Install, Setup and Manage Google Cloud SDK to Use Python From Anaconda
- 1. Install Python
- 2. Set up CLOUDSDK_PYTHON Environmental Variable
- 3. Download and Install Google Cloud SDK
- 4. Potential Error
- 5. Setup and Manage SDK
- Initializing SDK
- Authorizing SDK
- Managing Configurations
- Managing Components
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Google Cloud Client Library for Python
License
googleapis/google-cloud-python
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
…d nonce requests (#11525) Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou
Git stats
Files
Failed to load latest commit information.
README.rst
Google Cloud Python Client
Python idiomatic clients for Google Cloud Platform services.
The development status classifier on PyPI indicates the current stability of a package.
GA (general availability) indicates that the client library for a particular service is stable, and that the code surface will not change in backwards-incompatible ways unless either absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against GA libraries are addressed with the highest priority.
GA libraries have development status classifier Development Status :: 5 — Production/Stable .
Sub-components of GA libraries explicitly marked as beta in the import path (e.g. google.cloud.language_v1beta2 ) should be considered to be beta.
Beta indicates that the client library for a particular service is mostly stable and is being prepared for release. Issues and requests against beta libraries are addressed with a higher priority.
Beta libraries have development status classifier Development Status :: 4 — Beta .
Alpha indicates that the client library for a particular service is still a work-in-progress and is more likely to get backwards-incompatible updates. See `versioning`_ for more details.
Alpha libraries have development status classifier Development Status :: 3 — Alpha .
If you need support for other Google APIs, check out the Google APIs Python Client library.
- getting-started-python — A sample and tutorial that demonstrates how to build a complete web application using Cloud Datastore, Cloud Storage, and Cloud Pub/Sub and deploy it to Google App Engine or Google Compute Engine.
- google-cloud-python-expenses-demo — A sample expenses demo using Cloud Datastore and Cloud Storage.
With google-cloud-python we try to make authentication as painless as possible. Check out the Getting started with authentication in our documentation to learn more.
Apache 2.0 — See the LICENSE for more information.
Using the Google Cloud CLI installer
The Google Cloud CLI provides an installer for each supported platform and can be deployed interactively or non-interactively.
Interactive installation
The installer lets you download, install, and set up the latest version of Google Cloud CLI in an interactive mode. When you run the installer, it downloads Google Cloud CLI components and installs them on the local system. It also performs additional setup tasks like adding gcloud CLI components to your PATH and enabling command completion in your shell.
- At the command line, run the following command:
curl https://sdk.cloud.google.com | bash
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe") & $env:Temp\GoogleCloudSDKInstaller.exe
- If your installation is unsuccessful due to the find command not being recognized, ensure your PATH environment variable is set to include the folder containing find . Usually, this is C:\WINDOWS\system32; .
- If you uninstalled the gcloud CLI, you must reboot your system before installing the gcloud CLI again.
- If unzipping fails, run the installer as an administrator.
You can also install the latest version from a downloaded .zip file:
- Download google-cloud-sdk.zip and extract its contents. (Right click on the downloaded file and select Extract All.)
- Launch the google-cloud-sdk\install.bat script and follow the installation prompts.
- When the installation finishes, restart the command prompt ( cmd.exe ).
- Run gcloud init :
Non-interactive (silent) deployment
You can automate Google Cloud CLI installation using the install script.
For Linux and MacOS:
Save the install script locally instead of piping it to bash.
- Enter the following at a command prompt:
curl https://sdk.cloud.google.com > install.sh
bash install.sh --disable-prompts
- `--disable-prompts` - disable prompts. - `--install-dir=DIRECTORY` - set the installation root directory to `DIRECTORY`. The Google Cloud CLI is installed in `DIRECTORY/google-cloud-sdk`. The default is $HOME.
For Windows:
- /S — install silently. No installer pages are displayed. Use flags to change install settings.
- /D — set the default installation directory. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported, for example /D=C:\CloudSDK
- /allusers — install for all users
- /singleuser — install for current user (default)
- /screenreader — turn on screen reader mode (default is to turn it off)
- /reporting — enable usage reporting (default is to turn off usage reporting)
- /noreporting — disable usage reporting (default is to turn off usage reporting)
- /nostartmenu — don’t create start menu shortcut (default is to create shortcut)
- /nodesktop — don’t create desktop shortcut (default is to create shortcut)
Try it for yourself
If you’re new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-07-25 UTC.
Install, Setup and Manage Google Cloud SDK to Use Python From Anaconda
As a power user of Google Cloud Platform, you definately need to use gcloud , gsutil and bq commands to work with GCP, which means you need to install Google Cloud SDK on your local computer. You can install the Cloud SDK through many options, including versioned archives, installer, apt-get/yum for Linux distro, and even Docker image. This post describes the process of installing the Cloud SDK through versioned archive on operating systems that have already installed Python through Anaconda. The process has been tested on both Windows 10 and Ubuntu 18.04.
Installing through versioned archives might be the best way for non-interactive installation of a specific version of the Cloud SDK. Each of the versioned archive has a self-contained Cloud SDK packages in a directory that can be copied to any location on your file system. Thus it doesn’t need to run any installer on your system.
Google Cloud SDK needs Python, however, its bundled Python package is still 2.7 and most of the Cloud SDK components already switch to Python 3 since version 274.0.0. In order to use an existing Python on your systems, especially, the Python is managed by Anaconda, you might need to follow the process described in this post to make things work.
1. Install Python
If you are still using Python2, I highly recommend you to change to Python3 now. If you have not used Anaconda yet, I also highly recommend you to try it out. You can follow this post to install and quick-start Anaconda.
2. Set up CLOUDSDK_PYTHON Environmental Variable
- If you are using Windows, add the following variables to your Environmental Variables:
- Variable name: CLOUDSDK_PYTHON
- Variable value: path\to\anaconda3\python.exe
export CLOUDSDK_PYTHON="/path/to/anaconda3/bin/python"
and don’t froget to run source .bashrc to refressh your change.
3. Download and Install Google Cloud SDK
- Download the appropriate versioned archive compatible with your system from the download page.
- Extract the contents of the file to any location on your file system.
- Add the Cloud SDK bin folder to your PATH environment:
- On Windows:
- run the command .\google-cloud-sdk\install.bat or
- manually add path\to\google-cloud-sdk\bin to the PATH environmental variable.
- run the command ./google-cloud-sdk/install.sh or
- manually add export PATH=»/path/to/google-cloud-sdk/bin:$PATH» to .bashrc
4. Potential Error
After finishing above three steps, you run gcloud —help to make sure everything works. You might see the error message as shown below:
This is causes by the Anaconda environment initialization. You need to run activate base to activate your base environment before run the gcloud commands.
5. Setup and Manage SDK
Initializing SDK
With a fresh installation of SDK, the first step is typically to run the gcloud init command to authorize access to GCP project and create a new configuration with a set of base setings.
If required, you can use the following command to prevent the command from lauching a browser-based authorization flow:
The gcloud init command usually creates a new configuration with the name of default . Please note that there is nothing special about the intitial default configuration and you can name it with whatever name you want.
You can use the gcloud config set command to set the properties of this configuration. For example:
gcloud config set project myProject # set project to myProject gcloud config set compute/zone us-west2-b # set zone to us-west2-b
Authorizing SDK
If you just need to authorize with a user account without setting up a configuration, you can run:
If you need to authorize with a service account instead of a user account, you can run:
gcloud auth activate-service-account
Managing Configurations
If you are using multiple projects with multiple authorization accounts, you would like to create multiple configurations — one for each project.
You can use the following command to create a configuration:
gcloud config configurations create [CONFIGURATION_NAME]
You can use the following command to activate a configuration:
gcloud config configurations activate [CONFIGURATION_NAME]
You can use the following command to list all configurations:
gcloud config configurations list
You can use the following command to delete a configruation:
gcloud config configurations delete [CONFIGURATION_NAME]
You can use the following command to check properties of a configuration:
gcloud config list gcloud config list --configuration=[CONFIGURATION_NAME]
You can use the following command to set properties of a configuration:
gcloud config set compute/zone us-west2-a gcloud config set compute/zone us-west2-a --configuration=[CONFIGURATION_NAME]
Managing Components
The default components of the Cloud SDK are gcloud , bq , gsutil and core .
You can use the following command to check the components installed:
If you want to install additional component you can run the following command:
gcloud components install [COMPONENT_ID]
You can run the following command to make sure that all components of the SDK are up to date:
and run the following command to install the beta components:
gcloud components install beta
- On Windows: