skillfed

problog

ProbLog2: Probabilistic Logic Programming toolbox

problog v2.2.10 302.5K downloads/30d#7,821 on PyPI
Permissive license Apache Software License Active released

What it is and what it does

ProbLog is a Python package for probabilistic logic programming that lets you write logic programs where facts can be annotated with probabilities. It solves inference problems by converting programs and queries into weighted Boolean formulas, then using algorithms from graphical models and knowledge compilation to compute answers. The package handles tasks like computing marginal probabilities given evidence and learning from partial interpretations.

You can represent knowledge bases as Prolog/Datalog facts, CSV files, SQLite tables, or Python functions. It's designed for situations where you need to encode both complex interactions between components and the inherent uncertainties in real-world data. The package is actively maintained, supports Python 3.8 through 3.12, and installs cleanly with minimal dependencies.

Use it for:

  • Build probabilistic reasoning systems that combine logical rules with uncertain facts to compute outcome probabilities
  • Learn probabilistic logic programs from partial interpretations or labeled examples in AI/ML workflows
  • Model real-world systems with both deterministic rules and probabilistic components (e.g., sensor fusion, diagnosis)
  • Perform inference over knowledge bases stored in Prolog, CSV, or SQLite with probability annotations
  • Reduce probabilistic inference to weighted model counting for integration with knowledge compilation solvers

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

ProbLog is a probabilistic logic programming toolbox that combines logic programming with probability annotations to perform inference tasks like computing marginals given evidence and learning from interpretations.

Yes. ProbLog is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It fills a specific niche in probabilistic logic programming with a mature codebase (first released in 2015) and clear documentation. Install it if you need to combine logic programming with probabilistic reasoning; skip it if you're looking for general-purpose Bayesian inference or constraint solving.

Install

problog on PyPI

pip

pip install problog

uv

uv add problog

poetry

poetry add problog

Installing problog

Before you install

Low install friction; ships as a pure Python wheel with only setuptools as a runtime dependency. Actively maintained with a release 149 days ago.

License in practice

Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes.

Quickstart

pip install problog

from problog.program import PrologString
from problog.engine import DefaultEngine

program = PrologString("""
0.5::heads.
query(heads).
""")

result = DefaultEngine().prepare(program).evaluate()

Verify before relying

  • Whether the package supports Java embedding as claimed in the description excerpt
  • Whether CSV and SQLite integration work out-of-the-box or require optional dependencies
  • Performance characteristics for large-scale probabilistic programs

Package facts

License Apache Software License (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — setuptools
Maintenance actively maintained — 149 days since the last release
First released
Downloads 302,512/month — #7,821 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: problog-2.2.10-py3-none-any.whl

Keywords: prolog, probabilistic, logic

Development Status :: 4 - BetaIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PrologProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial Intelligence

Tags

probabilistic logic programmingprolog with probabilitiesweighted model countingprobabilistic inferencelogic program uncertaintybayesian logic programmingknowledge compilation
logic-programmingprobabilistic-inferenceknowledge-representation

More Artificial Intelligence packages

Further reading