Installation

Whether you're installing the library from PyPI or cloning it from GitHub, we recommended that you conduct the below steps using an active virtual environment. For information on how to create and activate a virtual environment, see the Virtual Environment documentation.

Install the module from PyPI

The library is distributed on PyPI and can be installed using pip with the following command:

python -m pip install google-ads

Install the library from GitHub

The source code for the library can be cloned from GitHub onto your local machine. It's useful to clone the source code in order to easily execute the examples or to develop the library itself. For reference, running one of the authentication examples is a required step in configuring the library for use.

  1. Ensure that python3.8 or later is present in your environment. The simplest way is to use pyenv:

    pyenv local 3.8
  2. Clone the client library from GitHub:

    git clone git@github.com:googleads/google-ads-python.git
  3. Enter the repository and install it:

    cd google-ads-python
    python -m pip install .
  4. If you intend to develop the library, run the unit tests before and after making any changes:

    1. Ensure you have all supported versions of the Python language available in your environment. Using pyenv::

      pyenv local 3.8 3.9 3.10 3.11 3.12
    2. Install the test-specific dependencies of the library:

      python -m pip install .[tests]
    3. Run the unit tests to ensure the library is functioning properly:

      nox
    4. Optional: the unit tests can also be run using Docker. First, you must have Docker installed. Then, from the google-ads-python directory, run the following:

      docker build -t google-ads-python:test .
      docker run -it google-ads-python:test nox