clingo
CFFI-based bindings to the clingo solver.
Decision gist · record as of 2026-08-14
Yes, if you need to solve combinatorial or constraint satisfaction problems and prefer declarative logic programming over imperative search. The package is actively maintained, has no known vulnerabilities, and carries a permissive license. Medium install friction is acceptable for most platforms. Not necessary if your problems fit standard optimization libraries or if you prefer imperative constraint solvers.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.6 or later; compiled wheels available for common platforms but may require build tools on unsupported architectures.
- Medium install friction due to compiled C extensions; pre-built wheels cover most common platforms (macOS x86_64 and ARM, Linux x86_64/i686/aarch64/ppc64le, Windows).
- Dependency on cffi is straightforward.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute clingo with minimal restrictions, making it suitable for both open-source and proprietary projects.
last release 2026-08-14 (0 days) · last repo commit 2026-08-14 · 822 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 157,813 downloads/mo, #10,745 on PyPI
Alternatives
Verify before relying
pip install clingo
import clingo
ctl = clingo.Control()
ctl.add("base", [], "a :- not b. b :- not a.")
ctl.ground([("base", [])])
ctl.solve(on_model=lambda m: print(m))- Whether the package includes pre-built wheels for all Python versions beyond 3.10 and 3.11 (fact sheet shows only 3.10 and 3.11 wheels).
- Performance characteristics and typical solve time for different problem sizes and complexity classes.
What it is and what it does
Clingo is a Python interface to the clingo Answer Set Programming solver, part of the Potassco project. It lets you express combinatorial problems—scheduling, configuration, planning, constraint satisfaction—as declarative logic programs rather than imperative algorithms. You write rules describing what solutions must satisfy, and clingo computes all answer sets (solutions) that satisfy those rules. The package wraps the C++ clingo engine via CFFI, giving you access to the solver's full capabilities from Python.
Typical workflows involve creating a Control object, adding logic program rules as strings, grounding the program (instantiating it with concrete data), and then calling solve() to enumerate or find solutions. It's used for problems where you want to specify constraints and let the solver find valid assignments, rather than writing search code yourself.
Use it for
- Solve scheduling and resource allocation problems by encoding constraints as logic rules and computing valid schedules.
- Perform configuration management or product configuration by modeling dependencies and constraints as ASP rules.
- Solve combinatorial puzzles (Sudoku, graph coloring, N-queens) by expressing the rules and letting clingo find all solutions.
- Perform planning and reasoning tasks where you need to compute all possible action sequences satisfying given goals.
- Prototype constraint satisfaction problems quickly without implementing custom search algorithms.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to solve combinatorial or constraint satisfaction problems and prefer declarative logic programming over imperative search.
The package is actively maintained, has no known vulnerabilities, and carries a permissive license. Medium install friction is acceptable for most platforms. Not necessary if your problems fit standard optimization libraries or if you prefer imperative constraint solvers.
Install
clingo on PyPI
Before you install
Medium install friction due to compiled C extensions; pre-built wheels cover most common platforms (macOS x86_64 and ARM, Linux x86_64/i686/aarch64/ppc64le, Windows). Dependency on cffi is straightforward. Package is actively maintained with a recent release.
Requires Python 3.6 or later; compiled wheels available for common platforms but may require build tools on unsupported architectures.
License in practice
MIT license is permissive; you can use, modify, and distribute clingo with minimal restrictions, making it suitable for both open-source and proprietary projects.
Quickstart
pip install clingo
import clingo
ctl = clingo.Control()
ctl.add("base", [], "a :- not b. b :- not a.")
ctl.ground([("base", [])])
ctl.solve(on_model=lambda m: print(m))
Verify before relying
- Whether the package includes pre-built wheels for all Python versions beyond 3.10 and 3.11 (fact sheet shows only 3.10 and 3.11 wheels).
- Performance characteristics and typical solve time for different problem sizes and complexity classes.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.6 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagecffi |
| Maintenance | Actively maintained 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 157,813 / month, #10,745 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: clingo-5.8.2-cp310-cp310-macosx_10_9_x86_64.whl; clingo-5.8.2-cp310-cp310-macosx_11_0_arm64.whl; clingo-5.8.2-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; clingo-5.8.2-cp310-cp310-manylinux_2_26_i686.manylinux_2_28_i686.whl; clingo-5.8.2-cp310-cp310-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl; clingo-5.8.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; clingo-5.8.2-cp310-cp310-musllinux_1_2_i686.whl; clingo-5.8.2-cp310-cp310-musllinux_1_2_x86_64.whl; clingo-5.8.2-cp310-cp310-win32.whl; clingo-5.8.2-cp310-cp310-win_amd64.whl; clingo-5.8.2-cp311-cp311-macosx_10_9_x86_64.whl; clingo-5.8.2-cp311-cp311-macosx_11_0_arm64.whl; clingo-5.8.2-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; clingo-5.8.2-cp311-cp311-manylinux_2_26_i686.manylinux_2_28_i686.whl; clingo-5.8.2-cp311-cp311-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl; clingo-5.8.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; clingo-5.8.2-cp311-cp311-musllinux_1_2_i686.whl; clingo-5.8.2-cp311-cp311-musllinux_1_2_x86_64.whl; clingo-5.8.2-cp311-cp311-win32.whl; clingo-5.8.2-cp311-cp311-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “answer set programming solver”
- clingoClingo is a Python binding to the clingo Answer Set Programming…
- xpressPython interface to the FICO Xpress Optimizer for creating and…
- highspyHighspy is a Python wrapper around HiGHS, a high-performance solver…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also advent-of-code · python-constraint · mip · pycosat · PuLP · pyomo · kiwisolver · claripy · optlang · docplex