How to Set Up dbt on Windows (Step-by-Step)
Previously, we wrote about setting up dbt on a Mac. Now, let’s talk about how to do it on Windows! While the core steps remain similar—installing Python, setting up a virtual environment, configuring Git, and installing dbt—there are key differences due to how Windows handles system paths, package management, and command-line tools.
On Mac, we use Homebrew to install dependencies, but on Windows, we rely on direct installations and package managers like Chocolatey or Winget. Additionally, activating a virtual environment on Windows requires slightly different commands. With that in mind, let’s dive into the setup!
Step 1: Install Git and Python
Before setting up dbt, ensure you have Git and Python installed.
Installing Git
First, download Git from the official website: Git for Windows. Then, run the installer and:
Choose "Git from the command line and also from 3rd-party software."
Select "Use the default Windows console window."
Leave other options as default and complete the installation.
Then, verify the installation by running the following in Command Prompt. If you see a version number, Git is successfully installed.
git --version
Installing Python
First, download Python from python.org. Then, run the installer and check the box for "Add Python to PATH." Then, complete the installation. Once you've completed the installation, verify by running the following in Command Prompt. If you see a version number, Python is ready to go!
python --version
Step 2: Set Up Your Project Folder
Now, it's time to create a folder where your dbt project will live. First, open Command Prompt (Win + R, type cmd, and hit Enter). Then, run the following commands to create and enter your project folder:
mkdir my_dbt_project cd my_dbt_project
Now you’re inside your project folder!
Step 3: Set Up a Virtual Environment
Creating a virtual environment keeps dbt isolated from other Python projects. First, run the following command inside your project folder. This creates a (venv) folder inside your project.
python -m venv venv
Then, activate the virtual environment. If you see (venv) at the beginning of your command line, you’re inside the virtual environment.
venv\Scripts\activate
Step 4: Initialize Git (Optional but Recommended)
If you're using Git for version control, initialize a repository. First, start a new Git repository:
git init
OR clone an existing dbt project:
git clone <repository-url> cd <project-folder-name>
Now, your project is under version control!
Step 5: Set Up the profiles.yml File
The profiles.yml file tells dbt how to connect to your data warehouse (like Snowflake, BigQuery, or Postgres). This file is typically found in C:\Users <your_username>\.dbt\profiles.yml.
Locate or Create the File
First, check if the file exists by running the following command.
cd %USERPROFILE%\.dbt && dir
If profiles.yml is missing, create it:
mkdir %USERPROFILE%\.dbt notepad %USERPROFILE%\.dbt\profiles.yml
Example Configuration (For Snowflake)
Copy and paste this into profiles.yml, replacing placeholders with your actual Snowflake credentials.
my_dbt_project: outputs: dev: type: snowflake account: <account_name> user: <username> password: <password> role: <role> database: <database_name> warehouse: <warehouse_name> schema: <schema_name> target: dev
Step 6: Install dbt
Now, it's time to install dbt inside your virtual environment. Ensure your virtual environment is active by running the following. (venv) should be visible in the prompt.
pip install dbt-core dbt-snowflake
Replace dbt-snowflake with dbt-postgres, dbt-bigquery, etc., depending on your data warehouse.
Step 7: Verify your dbt Installation
Check if dbt is installed correctly:
dbt --version
You should see the installed dbt version and plugins. If it works, congratulations—dbt is set up!
Troubleshooting Tips
If you run into issues, here are some quick solutions.
Virtual Environment Not Activating
If venv\\Scripts\\activate doesn’t work, try:
call venv\Scripts\activate
Or, if using PowerShell, run:
venv\Scripts\Activate.ps1
If you get a security error, enable script execution with:
Set-ExecutionPolicy Unrestricted -Scope Process
pip Command Not Found
If pip isn’t recognized, install it manually:
python -m ensurepip --default-pip
dbt Command Not Found
Ensure your virtual environment is activated before running dbt.
What's Next?
Now that dbt is installed, you can start transforming your data! Some next steps to explore:
Running dbt commands like dbt run and dbt test.
Learning about dbt models, tests, and macros.
Setting up dbt Cloud for team collaboration.
Congrats on making it through the setup! 🎉
Need expert help with your modern data stack?
Whether you're setting up dbt locally or building scalable analytics workflows, Database Tycoon offers hands-on data stack consulting to help growing teams move faster.