Installation
pyDatalog can be easily installed from the Python Package Index (PyPI).
Quick Installation
Using pip
You can install pyDatalog and its optional dependencies (like SQLAlchemy) using standard pip:
Using uv
If you manage your project using uv, you can run:
To run a script in an isolated environment directly:
Installation on PyPy
pyDatalog fully supports PyPy for accelerated JIT performance. You can install it using PyPy's pip tool:
Installation in WebAssembly (Pyodide)
Since pyDatalog is distributed with a pure Python wheel, it can be run out of the box in WebAssembly-based Python environments (like Pyodide or JupyterLite).
To load and use pyDatalog inside Pyodide, install it using micropip:
After installation, you can import and use the library:
Installation from Source
You can build and install pyDatalog directly from the source code. This is useful if you want to modify the source code or use development builds.
1. Download the Source
Clone the repository:
2. Install the Package
Run pip to install it in editable mode or from the local directory:
[!NOTE] During installation from source (instead of from pre-built wheels), the build system will attempt to compile the Cython speed-up extension. If compilation fails (e.g., due to a missing C compiler or missing Python header files), the installation will automatically and gracefully fall back to installing the pure Python implementation of the execution engine.
Verifying the Installation
To verify that pyDatalog has been installed correctly, open a Python interactive shell and run:
If it executes without errors and prints the version number, the installation was successful!
Checking if the C extension is used
If you installed pyDatalog from source and want to verify whether the compiled C speed-up extension is active (instead of the pure Python fallback), import pyEngine and check its file path:
- Compiled C extension is active: The file path will end in a compiled extension extension like
.so(on Linux/macOS) or.pyd(on Windows). - Pure Python fallback is active: The file path is
pyEngine.py.