# Prerequisites

This page guides you through the Google Cloud Cortex Framework deployment
prerequisites. Complete each prerequisite before starting the
[Demo deployment](https://docs.cloud.google.com/cortex/docs/demo-deployment.md.txt) or the
[Production deployment](https://docs.cloud.google.com/cortex/docs/deployment.md.txt).

## Installation artifacts

The first step is to download the Cortex Framework artifacts
to your local development environment.

### Windows environment setup

If you work on Linux, macOS, or Cloud Shell, skip to
[Clone the repository](https://docs.cloud.google.com/cortex/docs/prerequisites.md.txt#clone-repository).

By default, Windows limits paths to 260 characters. Cloning the
Cortex Framework repository, building local Dataform
packages, or installing Node.js dependencies can create paths that exceed this
limit.

Before you clone the repository or run a build, enable long path support:

1. Enable Win32 long paths: Run PowerShell **as Administrator**, then sign
   out of Windows and sign back in:

   ```powershell
   New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
     -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
   ```

   Alternatively, open `gpedit.msc`, go to **Computer Configuration** \>
   **Administrative Templates** \> **System** \> **File System** , enable **Enable
   Win32 long paths**, and then sign out and sign back in.
2. Enable long paths in Git:

   ```powershell
   git config --global core.longpaths true
   ```

### Optional: Windows Subsystem for Linux (WSL2)

If your team prefers a Linux toolchain, all Cortex Framework CLI
tools and
[agent skills](https://docs.cloud.google.com/cortex/docs/agentic-skills-for-data-product-building.md.txt) work
unchanged inside WSL2 (such as Ubuntu). Keep the cloned project on the Linux
file system (for example, `~/src/cortex`), not under `/mnt/c/...`, for
acceptable performance. When you work inside WSL2 on the Linux file system, the
preceding Windows-specific steps don't apply.

### Clone the repository

Clone the Cortex Framework repository from
[GitHub](https://github.com/GoogleCloudPlatform/cortex-framework):

```bash
git clone https://github.com/GoogleCloudPlatform/cortex-framework
```

Change to the cloned repository directory:

```bash
cd cortex-framework
```

## Install `uv`

[`uv`](https://docs.astral.sh/uv/) is a fast Python package and environment
manager written in Rust. Cortex Framework uses `uv` to maintain
isolated, reproducible build and deployment environments.

> [!NOTE]
> **Note:** If you run commands from Cloud Shell, `uv` is preinstalled and you can skip this step.

Install `uv` by following the
[`uv` installation instructions](https://docs.astral.sh/uv/getting-started/installation/).

## Synchronize required dependencies

Cortex Framework requires **Python 3.13** .
Synchronize Python dependencies and initialize the virtual environment (`uv`
automatically downloads a matching Python 3.13 runtime if one isn't installed
locally):

```bash
uv sync
```

### Optional: Install Dataform CLI

Standard `uv run cortex-build` and `uv run cortex-deploy` runs require only
Python and `uv`. Install Node.js (`npx`) or the `@dataform/cli` binary in your
system `PATH` if you plan to do any of the following:

- Build, extend, or validate modules with the agentic data product builder ([agent skills](https://docs.cloud.google.com/cortex/docs/agentic-skills-for-data-product-building.md.txt)), which runs `uv run cortex-metadata` and `uv run cortex-compile`.
- Run offline Dataform compilation checks for modules and [data quality assertions](https://docs.cloud.google.com/cortex/docs/data-quality-assertions.md.txt#validate-and-deploy) with [`uv run cortex-compile`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-compile.md.txt).
- Cache and inspect foundation or data product schemas locally with [`uv run cortex-metadata`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-metadata.md.txt).

Install `@dataform/cli` globally:

```bash
npm install -g @dataform/cli
```

## Configure the Google Cloud CLI

> [!NOTE]
> **Note:** If you run `gcloud` commands for the first time in your local environment, or if you encounter authentication errors, run the following commands to authenticate the gcloud CLI.

```bash
gcloud auth login
gcloud auth application-default login
```

## Prepare your Dataform project

Before running a deployment, verify that you have access to a
[Google Cloud project](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects.md.txt#console)
with an
[attached billing account](https://docs.cloud.google.com/billing/docs/how-to/verify-billing-enabled.md.txt#confirm_billing_is_enabled_on_a_project).

> [!NOTE]
> **Note:** This project serves as the default project for `gcloud` commands and Dataform repository hosting. It isn't automatically used as the target project in your Cortex Framework deployment. You configure build, source, and target projects separately in `config/config.yaml`.

Configure your gcloud CLI environment to use your Google Cloud project:

```bash
# Set current project and quota project
gcloud config set project PROJECT_ID
gcloud auth application-default set-quota-project PROJECT_ID
```

Replace the following:

- `PROJECT_ID`: your Google Cloud project ID, for example: `my-cortex-project`.

### Enable Google Cloud services

Enable the following core Google Cloud APIs in your deployment projects
(you can also pass `--enable-apis` to `uv run cortex-build`,
`uv run cortex-deploy`, `uv run cortex-build-and-deploy`,
`uv run cortex-apply-security`, `uv run cortex-demo`,
`uv run cortex-create-kc-data-products`, `uv run cortex-create-ca-agents`, or
`uv run cortex-register-gemini-agents` to enable required APIs automatically):

- BigQuery API (`bigquery.googleapis.com`)
- Dataform API (`dataform.googleapis.com`)
- Cloud Resource Manager API (`cloudresourcemanager.googleapis.com`, used for BigLake Delta Sharing capacity validation and telemetry project-number lookups)

Optional integrations---such as demo sample loading, BigQuery sharing,
BigLake Delta Sharing, row- and column-level security,
Knowledge Catalog, conversational analytics, and Gemini---require
additional APIs listed after the following command.

Enable these Google Cloud services in
[Cloud Shell](https://shell.cloud.google.com/?fromcloudshell=true&show=ide,terminal)
or your local terminal:

```bash
gcloud config set project PROJECT_ID

gcloud services enable cloudresourcemanager.googleapis.com \
                       bigquery.googleapis.com \
                       dataform.googleapis.com \
                       --project=PROJECT_ID

# Optional: Enable APIs for demo sample loading (Cloud Storage), BigQuery sharing
# (Analytics Hub / Salesforce Data 360), BigLake Delta Sharing (SAP BDC),
# row- and column-level security (column policy tags), Knowledge Catalog,
# conversational analytics, and Gemini:
gcloud services enable storage.googleapis.com \
                        analyticshub.googleapis.com \
                        biglake.googleapis.com \
                        bigqueryreservation.googleapis.com \
                        datacatalog.googleapis.com \
                        bigquerydatapolicy.googleapis.com \
                        dataplex.googleapis.com \
                        geminidataanalytics.googleapis.com \
                        cloudaicompanion.googleapis.com \
                        discoveryengine.googleapis.com \
                        --project=PROJECT_ID
```

Replace the following:

- `PROJECT_ID`: your Google Cloud project ID, for example: `my-cortex-project`.

Depending on which optional integrations or workflows you run, also enable the
following APIs in the relevant Google Cloud projects:

- **Demo deployment sample data loading (`uv run cortex-demo`)** : `storage.googleapis.com` on your demo target project when loading sample raw data from Cloud Storage. See [Demo deployment](https://docs.cloud.google.com/cortex/docs/demo-deployment.md.txt).
- **BigQuery sharing catalogs (`type: analytics_hub`)** : `analyticshub.googleapis.com` and `bigquery.googleapis.com` on the project hosting your subscribed linked datasets (including Salesforce Data 360). See [BigQuery sharing integration](https://docs.cloud.google.com/cortex/docs/source-system-integration/analytics-hub.md.txt) and [Salesforce Data 360 integration](https://docs.cloud.google.com/cortex/docs/source-system-integration/salesforce-data-cloud.md.txt).
- **BigLake Delta Sharing catalogs (`type: lakehouse_delta_share`)** : `biglake.googleapis.com`, `bigquery.googleapis.com`, `bigqueryreservation.googleapis.com`, and `cloudresourcemanager.googleapis.com` on the catalog project. See [SAP Business Data Cloud integration](https://docs.cloud.google.com/cortex/docs/source-system-integration/sap-bdc.md.txt).
- **Row- and column-level security (column policy tags)** : `datacatalog.googleapis.com` (Data Catalog API) on every project hosting a referenced policy tag taxonomy and on every target project hosting tables governed by column-level security (CLS). When configuring BigQuery data policies for optional dynamic data masking, also enable `bigquerydatapolicy.googleapis.com` (BigQuery Data Policy API) on both the taxonomy project and every CLS-governed target project. See [Row- and column-level security](https://docs.cloud.google.com/cortex/docs/row-and-column-security.md.txt).
- **Knowledge Catalog synchronization
  ([`uv run cortex-create-kc-data-products`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-kc-data-products.md.txt))** : `dataplex.googleapis.com` on the catalog or governance project (`--kc-project-id`, or each synced product's target project when omitted) and `bigquery.googleapis.com` on each synced product's target dataset project. Pass `--enable-apis` to enable missing APIs automatically. See [Knowledge Catalog
  integration](https://docs.cloud.google.com/cortex/docs/knowledge-catalog).
- **Conversational analytics data agents
  ([`uv run cortex-create-ca-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-create-ca-agents.md.txt))** : `geminidataanalytics.googleapis.com`, `cloudaicompanion.googleapis.com`, and `bigquery.googleapis.com` (for zero-cost golden-query dry runs) on `buildProjectId`. See [Conversational analytics integration](https://docs.cloud.google.com/cortex/docs/conversational-analytics.md.txt).
- **Gemini agent registration
  ([`uv run cortex-register-gemini-agents`](https://docs.cloud.google.com/cortex/docs/uv-run-cortex-register-gemini-agents.md.txt))** : `discoveryengine.googleapis.com` and `geminidataanalytics.googleapis.com` on `buildProjectId`. See [Gemini integration](https://docs.cloud.google.com/cortex/docs/gemini.md.txt).

## Troubleshooting

The following table describes common local setup issues on Windows and how to
resolve them:

| Symptom | Cause | Resolution |
|---|---|---|
| `Filename too long`, `ENAMETOOLONG`, or `The system cannot find the path specified` during `git clone`, `npm install`, or build | Long path support isn't enabled on Windows or Git. | Complete [Windows environment setup](https://docs.cloud.google.com/cortex/docs/prerequisites.md.txt#windows-setup) to enable Win32 and Git long paths, then sign out of Windows and sign back in. |
| Running `python3` opens the Microsoft Store | Windows App Execution Alias intercepts `python3` with a Microsoft Store placeholder. | Use `uv run python ...`, or turn off the alias in **Settings \> Apps \> Advanced app settings \> App execution aliases** . Avoid calling `python3` or `python` directly on Windows. |

## Next steps

Explore the following guides to build and deploy Cortex Framework:

- [Demo deployment](https://docs.cloud.google.com/cortex/docs/demo-deployment.md.txt): Deploy sample data in minutes to see Cortex Framework in action.
- [Production deployment](https://docs.cloud.google.com/cortex/docs/deployment.md.txt): Configure and deploy Cortex Framework for your enterprise data.