Skip to content
Allows the kdb+ interpreter to call Python functions
Python C Perl 6 q Dockerfile Batchfile Other
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
build use conda=4.5.1 Mar 14, 2019
conda-recipe block python 3.5 on windows Sep 4, 2018
docker use rlwrap only when attached to a tty Jan 4, 2019
examples new embedPy API Jan 24, 2018
tests is https only Mar 13, 2019
.dockerignore better dockerignore May 25, 2018
.gitignore initial docker Apr 20, 2018
.travis.yml docker deploy condition was incorrect Sep 4, 2018
LICENSE as received from @jhanna Nov 2, 2017
appveyor.yml conda package build Aug 13, 2018
makefile stricter compiler flags Oct 26, 2018
p.k Added p.k Nov 7, 2017
p.q replace .p.key and .p.value Apr 11, 2019
py.h stricter compiler flags Oct 26, 2018
test.q modified test script to take files as arguments Sep 24, 2018


Allows the kdb+ interpreter to manipulate Python objects and call Python functions. Part of the Fusion for kdb+ interface collection.

Please direct any questions to

Please report issues in this repository.


  • kdb+ ≥ 3.5 64-bit
  • Python ≥ 3.5.0 (macOS/Linux) ≥ 3.6.0 windows


You can either

  • install embedPy to run on your local machine; or
  • download or build a Docker image in which to run embedPy

There are three ways to install embedPy on your local machine:

  1. Download and install a release

  2. Clone and build from source, on your local machine or in a Docker image

  3. Install with Conda - recommended for use with

Anaconda Python

If you are using Anaconda Python, we recommend installing with Conda. If, instead, you take option (1) or (2) above, and are using Linux or macOS, set your LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (macOS) to your Python distributions library directory to avoid conflicts between libraries which both q and Python use (e.g. libz, libssl). You can find this directory's location in Python.

>>> import sysconfig
>>> sysconfig.get_config_var('LIBDIR')


If you are currently using PyQ, both interfaces use a file p.k in $QHOME/{l64,m64} which results in a conflict when both are installed.

You may want to run initially from another directory, without installing. Skip the install step above, and run q in the directory where you unzipped the release.

Test script

The test script test.q requires the packages listed in tests/requirements.txt, although embedPy does not itself require them. They can be installed using pip or conda.

pip install -r tests/requirements.txt


conda install --file tests/requirements.txt

If the tests all pass, no message is displayed.

Install on local machine

Download and install a release

  1. Download a release archive from the releases page, and unzip it.

  2. In the unzipped directory, run the tests.

    $ q test.q
  3. Install: put p.q and p.k in QHOME and the library file ( for macOS/Linux or p.dll for Windows) in $QHOME/{l64,m64,w64}.

Clone and build from source

  1. Clone this repository from GitHub.

  2. To run embedPy without Internet access, download the kdb+ C API header file and place it in the build directory.

  3. Build the interface and run the tests.

    $ make && q test.q
  4. Install: put p.q and p.k in $QHOME and in $QHOME/{l64,m64}.

Install with Conda

This requires either macOS or Linux.

  1. Download and install either the full Anaconda distribution or Miniconda for Python3

  2. Use the conda command to install packages as follows:

    $ conda install -c kx embedPy

Run on local machine

Start q with embedPy

$ q p.q

Or from q, load p.q.

q)\l p.q

Documentation is on the embedPy homepage.

Run a Docker image

If you have Docker installed, instead of installing embedPy on your machine, you can run:

$ docker run -it --name myembedpy kxsys/embedpy
kdb+ on demand - Personal Edition


I agree to the terms of the license agreement for kdb+ on demand Personal Edition (N/y): y

If applicable please provide your company name (press enter for none): ACME Limited
Please provide your name: Bob Smith
Please provide your email (requires validation):
KDB+ 3.5 2018.04.25 Copyright (C) 1993-2018 Kx Systems
l64/ 4()core 7905MB kx 0123456789ab EXPIRE 2018.12.04 KOD #0000000


See docker/ for more details.

Back-incompatible changes

V1.0 -> V 1.1

.p.key and .p.value removed

V0.2-beta -> V1.0

  • Attribute access from embedPy object

    q)obj`ATTRNAME   / old
    q)obj`:ATTRNAME  / new
  • embedPy objects can be called directly without explicitly specifying the call return type; the default return type is an embedPy object

V0.1-beta -> V0.2beta in V0.2-beta

V0.2-beta features a number of changes back-incompatible with the previous release, V0.1-beta.

Most notably, the default type used in many operations is now the embedPy type, rather than the foreign type.

You can’t perform that action at this time.