Install or upgrade the Cognite Data Fusion Toolkit
Follow the steps in this article to install or upgrade the Cognite Data Fusion (CDF) Toolkit command line interface (CLI) and modules.
Prerequisites
Before you install the CDF Toolkit, you need:
- A recent version of Python, at minimum v3.9.
- The latest version of the CDF Python SDK.
Install the CDF Toolkit
Follow these steps to install the CDF Toolkit CLI and initialize the configuration files and modules.
Step 1: Install the CDF Toolkit
- The CDF Toolkit is published as a Python package and can be installed with pip or Poetry, ideally by using a virtual environment. Open up a terminal and install the CDF Toolkit with:
- pip
- poetry
pip install cognite-toolkit
poetry add cognite-toolkit
This automatically installs compatible versions of all dependencies.
If you're using a virtual Python environment manager, and you get a "command not found"
message in the terminal window, make sure you have activated the virtual environment, for example by using source .venv/bin/activate
or Poetry.
Step 2: Initialize the configuration files and modules
To create a directory, <proj_dir>
, for your CDF project configuration files and template modules, run this command in your terminal:
cdf-tk init <proj_dir>
This creates the <proj_dir>
directory and populates it with a set of configuration files and template modules to configure for your CDF projects.
Upgrade the CDF Toolkit
Follow these steps to upgrade the CDF Toolkit CLI and modules to the latest version.
The CDF Toolkit CLI and module must be the same version. If they're out of sync, the CDF Toolkit guides you on how to upgrade them to the same version.
Step 1: Upgrade the CDF Toolkit CLI
To upgrade the CDF Toolkit to the latest version, open up a terminal and run this command:
- pip
- poetry
pip install --upgrade cognite-toolkit
poetry add cognite-toolkit@latest
To upgrade the CDF Toolkit to a specific version, for example a beta version, open up a terminal and run this command:
- pip
- poetry
pip install cognite-toolkit==0.2.0b4
poetry add cognite-toolkit@0.2.0b4
Replace 0.2.0b4
with the version you want to install.
Step 2: Upgrade the CDF Toolkit modules
To update the CDF Toolkit modules to be compatible with the installed version of the CDF Toolkit CLI:
-
Open up a terminal and run this command:
cdf-tk init --upgrade
-
Follow the CDF Toolkit instructions to manually update the modules.
-
In the \cognite_modules\_system.yaml file, update the version number in the
cdf_toolkit_version
section.