Skip to content

Install KDB-X Python

Install KDB-X Python, configure a license, and verify the installation.

Estimated time: 5–10 minutes for a standard pip installation, license setup, and verification.

Software license terms

KX releases KDB-X Python under a dual license that covers the files in the KDB-X Python repository. Review the KDB-X Python license terms before installation.

Acceptance of license terms:

By downloading, installing, or using KDB-X Python, you acknowledge and agree that you have read, understood, and accept the KDB-X Python license terms.

Prerequisites

Before you start, make sure you have:

Create and activate a virtual environment to isolate KDB-X Python from other projects:

python3 -m venv .venv
source .venv/bin/activate
py -m venv .venv
.\.venv\Scripts\Activate.ps1
If PowerShell blocks virtual environment activation

PowerShell may require permission to run the activation script. Enable locally created scripts for the current PowerShell session, then activate the environment:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
.\.venv\Scripts\Activate.ps1

When prompted, confirm the policy change. The setting applies only to the current PowerShell session. PowerShell discards it when you close the window.

If an organizational policy prevents this change, run subsequent commands with .\.venv\Scripts\python.exe instead of python.

Supported environments

KX supports KDB-X Python wheels for CPython 3.9-3.14 on Linux, macOS, and Windows.

Supported wheel platform tags

The wheel platform tag depends on the operating system and, for Linux, the CPython version:

Platform CPython versions Wheel platform tags
Linux 3.9-3.11 manylinux2014_x86_64, manylinux2014_aarch64
Linux 3.12-3.14 manylinux_2_28_x86_64, manylinux_2_28_aarch64
macOS 3.9-3.14 macosx_10_15_x86_64, macosx_10_15_arm64
Windows 3.9-3.14 win_amd64

Install from PyPI

PyPI is the recommended installation method for most users. If you manage packages with Conda, uv, or pipx, or need to build from source, expand Other installation methods. For an offline system, follow Air-gapped installation.

Why the package is named pykx

KDB-X Python is the product name, but the Python distribution and import package remain pykx for compatibility with applications written for PyKX 3.x. Use pykx in package-manager commands and import pykx in Python code.

If you are upgrading from PyKX 3.x, review the migration guide.

Upgrade pip:

python -m pip install --upgrade pip

Install the latest KDB-X Python release from PyPI:

python -m pip install --upgrade pykx
Other installation methods

On Linux x86 and ARM architectures, create an environment and install KDB-X Python from the kx channel:

conda create --name kdbx-python python
conda activate kdbx-python
conda install -c kx pykx

Create a virtual environment and install KDB-X Python:

uv venv
uv pip install pykx

Install KDB-X Python and its dependencies in an isolated virtual environment:

pipx install pykx --include-deps

Activate the environment that pipx creates before you import KDB-X Python.

Install KDB-X Python directly from the repository:

git clone https://github.com/kxsystems/pykx
cd pykx
python -m pip install .

Building from source requires Git and may require platform-specific build tools. KX provides best-effort support for user-built installations.

Without a KDB-X license, KDB-X Python runs with reduced functionality. To continue without a license, skip to Verify the installation.

Install a KDB-X license

Before you start, make sure you have one of these KDB-X licenses ready:

  • A kc.lic license key from the KX Developer Center.
  • A k4.lic license provided separately by KX.

Review the KDB-X license requirements for more information.

Start an interactive Python session and import KDB-X Python:

$ python
>>> import pykx as kx

When prompted, confirm that you want to install a license. Choose a license file or base64-encoded license key, then provide its location or value.

Configure one license source before starting Python:

License source Environment variable Value
kc.lic or k4.lic file QLIC Directory that contains the license file
Base64-encoded kc.lic key KDB_LICENSE_B64 License key supplied by KX
Base64-encoded k4.lic key KDB_K4LICENSE_B64 License key supplied by KX

KDB-X Python reads the configured license when the Python process starts.

Verify the installation

Print the installed version and active license mode:

python -c "import pykx as kx; print(kx.__version__); print(f'Licensed: {kx.licensed}')"

The command prints the KDB-X Python version and one of these results:

  • Licensed: True confirms that KDB-X Python initialized embedded q with the installed license.
  • Licensed: False confirms that KDB-X Python runs in unlicensed mode.

If the result does not match your configuration, refer to Troubleshooting.

Air-gapped installation

Use a connected system that matches the operating system, architecture, and Python version of the air-gapped system.

Prepare a wheelhouse using one of these sources:

Download KDB-X Python and its dependencies:

$ python -m pip download --destination-directory wheelhouse pykx

Clone the repository and build KDB-X Python and its dependencies:

$ git clone https://github.com/kxsystems/pykx
$ cd pykx
$ python -m pip wheel --wheel-dir wheelhouse .

Copy the wheelhouse directory to the air-gapped system, then install from it. This example uses /opt/airgap/wheels:

python -m pip install --no-index --find-links=/opt/airgap/wheels pykx

After installation, install a KDB-X license and verify the installation.

Next steps