How to Install duckdb in Python
DuckDB in-process database
pip install duckdb
What is duckdb?
DuckDB in-process database
DuckDB.org | User Guide (Python) - API Docs (Python)
DuckDB: A Fast, In-Process, Portable, Open Source, Analytical Database System
Simple: DuckDB is easy to install and deploy. It has zero external dependencies and runs in-process in its host application or as a single binary. Portable: DuckDB runs on Linux, macOS, Windows, Android, iOS and all popular hardware architectures. It has idiomatic client APIs for major programming languages. Feature-rich: DuckDB offers a rich SQL dialect. It can read and write file formats such as CSV, Parquet, and JSON, to and from the local file system and remote endpoints such as S3 buckets. Fast: DuckDB runs analytical queries at blazing speed thanks to its columnar engine, which supports parallel execution and can process larger-than-memory workloads. Extensible: DuckDB is extensible by third-party features such as new data types, functions, file formats and new SQL syntax. User contributions are available as community extensions. Free: DuckDB and its core extensions are open-source under the permissive MIT License. The intellectual property of the project is held by the DuckDB Foundation.
Quick Start
Minimal example to get started with duckdb:
import duckdb
print(duckdb.__version__)
Installation
pip (standard)
pip install duckdb
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install duckdb
pip3
pip3 install duckdb
conda
conda install -c conda-forge duckdb
Poetry
poetry add duckdb
Verify the Installation
After installing, confirm the package is available:
python -c "import duckdb; print(duckdb.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing duckdb with pip.
ModuleNotFoundError: No module named 'duckdb'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install duckdb. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'duckdb' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install duckdb to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'duckdb'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show duckdb and upgrade with pip install --upgrade duckdb.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install duckdb. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user duckdb
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org duckdb
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Recent Releases
| Version | Released |
|---|---|
1.5.2.dev54 |
2026-04-11 |
1.5.2.dev52 |
2026-04-10 |
1.5.2.dev42 |
2026-04-08 |
1.5.2.dev40 |
2026-04-05 |
1.4.5.dev25 |
2026-04-03 |
Manage duckdb
Upgrade to latest version
pip install --upgrade duckdb
Install a specific version
pip install duckdb==1.5.1
Uninstall
pip uninstall duckdb
Check what is installed
pip show duckdb