{"id":28081,"library":"pycosat","title":"pycosat","description":"Python bindings to PicoSAT, a popular SAT solver written in C. Version 0.6.6 is the latest. The library is mature but receives infrequent updates; it is in maintenance mode.","status":"maintenance","version":"0.6.6","language":"python","source_language":"en","source_url":"https://github.com/ContinuumIO/pycosat","tags":["SAT","solver","picosat","cnf"],"install":[{"cmd":"pip install pycosat","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"itersolve is the generator version; solve is not a public function in pycosat.","wrong":"from pycosat import solve","symbol":"itersolve","correct":"from pycosat import itersolve"}],"quickstart":{"code":"import pycosat\n# Solve a SAT problem: each clause is a list of integers\ncnf = [[1, -2], [-1, 3], [-2, -3]]\nsolution = pycosat.itersolve(cnf)\nfor sol in solution:\n    print(sol)","lang":"python","description":"Solve a simple CNF SAT problem using the generator itersolve."},"warnings":[{"fix":"Replace `pycosat.solve(...)` with `next(pycosat.itersolve(...))` for a single solution.","message":"The function `solve` is not available; use `itersolve` or `blocksolve`.","severity":"deprecated","affected_versions":">=0.6"},{"fix":"Upgrade to 0.6.4 or later: `pip install --upgrade pycosat`.","message":"In version 0.6.4, a memory leak was fixed in `blocksolve()`. If you rely on heavy iteration, upgrade to avoid cumulative memory usage.","severity":"breaking","affected_versions":"<0.6.4"},{"fix":"Convert your problem to DIMACS CNF (list of lists of non-zero integers, no 0).","message":"pycosat only accepts DIMACS CNF format, not other SAT formats like DIMACS WCNF or OPB. Variables must be positive integers.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.6.6':14 'bind':3 'c':12 'cnf':34 'infrequ':24 'latest':17 'librari':19 'mainten':29 'matur':21 'mode':30 'picosat':5,33 'popular':7 'pycosat':1 'python':2 'receiv':23 'sat':8,31 'solver':9,32 'updat':25 'version':13 'written':10","created_at":"2026-05-09T05:53:37.760825+00:00","updated_at":"2026-05-09T05:53:37.760825+00:00","problems":[{"fix":"Use `next(pycosat.itersolve(cnf))` or `list(pycosat.itersolve(cnf))`.","cause":"pycosat does not expose a `solve` function; use `itersolve` or `blocksolve` instead.","error":"AttributeError: module 'pycosat' has no attribute 'solve'"},{"fix":"Upgrade to 0.6.4+ and consider splitting the problem into smaller chunks.","cause":"pycosat uses the PicoSAT library which may allocate large arrays for huge CNF formulas. Also, a memory leak in versions <0.6.4 could cause OOM.","error":"MemoryError: Unable to allocate ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ContinuumIO/pycosat","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pycosat/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}