Whether you're installing the library from PyPI or cloning it from GitHub,
perform the following steps using an active virtual environment. For information
on how to create and activate a virtual environment, see the
[Virtual Environment](https://docs.python.org/3/tutorial/venv.html) documentation.

To quickly create and activate a virtual environment:

```bash
python3 -m venv env
source env/bin/activate
```

## Install the module from PyPI

The library is distributed on [PyPI](https://pypi.org/project/google-ads/) and can be installed using
[pip](https://pip.pypa.io/en/stable/installing) with the following command:

```bash
python -m pip install google-ads
```

### Verify installation

Verify that the module was installed correctly:

```bash
python -c "import google.ads.googleads"
```

## Install the library from GitHub

The source code for the library can be cloned from [GitHub](https://github.com/googleads/google-ads-python/)
onto your local machine. Cloning the source code is useful to 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 a supported Python version (Python 3.9 through 3.14; Python 3.11
   or later recommended) is present in your environment. The simplest way is to
   use [`pyenv`](https://github.com/pyenv/pyenv-installer):

   ```bash
   pyenv install 3.13
   pyenv local 3.13
   ```
2. Clone the client library from GitHub:

   ```bash
   git clone https://github.com/googleads/google-ads-python.git
   ```
3. Enter the repository and install it in editable mode:

   ```bash
   cd google-ads-python
   python -m pip install -e .
   ```
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`:

      ```bash
      pyenv local 3.9 3.10 3.11 3.12 3.13 3.14
      ```
   2. Install the test-specific dependencies of the library:

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

      ```bash
      nox
      ```
   4. Optional: You can also run the unit tests using Docker. First, ensure
      you have [Docker installed](https://docs.docker.com/get-docker/). Then,
      from the `google-ads-python` directory, run the following commands:

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