Skip to main content

Install with pip

You need to use pip to install dbt Core on Windows or Linux operating systems. You can use pip or Homebrew for installing dbt Core on a MacOS.

You can install dbt Core and plugins using pip because they are Python modules distributed on PyPI.

Using virtual environments

We recommend using virtual environments (venv) to namespace pip modules.

  1. Create a new venv:
python -m venv dbt-env              # create the environment
  1. Activate that same virtual environment each time you create a shell window or session:
source dbt-env/bin/activate         # activate the environment for Mac and Linux OR
dbt-env\Scripts\activate # activate the environment for Windows

Create an alias

To activate your dbt environment with every new shell window or session, you can create an alias for the source command in your $HOME/.bashrc, $HOME/.zshrc, or whichever config file your shell draws from.

For example, add the following to your rc file, replacing <PATH_TO_VIRTUAL_ENV_CONFIG> with the path to your virtual environment configuration.

alias env_dbt='source <PATH_TO_VIRTUAL_ENV_CONFIG>/bin/activate'

Installing the adapter

Once you decide which adapter you're using, you can install using the command line. Beginning in v1.8, installing an adapter does not automatically install dbt-core. This is because adapters and dbt Core versions have been decoupled from each other so we no longer want to overwrite existing dbt-core installations.

For example, if using Postgres:

Upgrade adapters

To upgrade a specific adapter plugin:

python -m pip install --upgrade dbt-ADAPTER_NAME

Install dbt-core only

If you're building a tool that integrates with dbt Core, you may want to install the core library alone, without a database adapter. Note that you won't be able to use dbt as a CLI tool.

python -m pip install dbt-core

Change dbt Core versions

You can upgrade or downgrade versions of dbt Core by using the --upgrade option on the command line (CLI). For more information, see Best practices for upgrading in Core versions.

To upgrade dbt to the latest version:

python -m pip install --upgrade dbt-core

To downgrade to an older version, specify the version you want to use. This command can be useful when you're resolving package dependencies. As an example:

python -m pip install --upgrade dbt-core==0.19.0

pip install dbt

Note that, as of v1.0.0, pip install dbt is no longer supported, will raise an explicit error, and the dbt package on PyPI stopped receiving updates. Since v0.13, PyPI package named dbt was a simple "pass-through" of dbt-core and the four original database adapter plugins.

In the fall of 2023, the dbt package on PyPI became a supported method to install the dbt Cloud CLI.

If you have workflows or integrations that rely on installing the package named dbt, you can achieve the same behavior by installing the same five packages that it used:

python -m pip install \
dbt-core \
dbt-postgres \
dbt-redshift \
dbt-snowflake \
dbt-bigquery \
dbt-trino

Or, better yet, just install the package(s) you need!

0