Registry / ai-ml / pylbfgs

pylbfgs

JSON →
library0.2.0.16pypypi✓ verified 82d ago

PyLBFGS provides L-BFGS and OWL-QN optimization algorithms for large-scale unconstrained and bound-constrained optimization. Current version is 0.2.0.16, but development appears to be in maintenance mode with infrequent releases.

pip install pylbfgs
INSTALL
IMPORT
SIG · PYLBFGS
P
pylbfgs
ai-mlpythonv0.2.0.16
Install
3.8s avg
Import
Disk
90MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.0.16 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 3.8s
py 3.11
✕ build_error
✓ 3.6s
py 3.12
✕ build_error
✓ 3.4s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 4.4s
90MB installed
● package 90MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LBFGS
from lbfgs import LBFGS
from pylbfgs import LBFGS
fmin_lbfgs
from lbfgs import fmin_lbfgs
from pylbfgs import fmin_lbfgs
LBFGSError
from lbfgs import LBFGSError
from pylbfgs import LBFGSError

Minimize a simple quadratic function using L-BFGS.

import numpy as np from pylbfgs import LBFGS def evaluate(x, g): # f(x) = (x-2)^2, gradient = 2*(x-2) f = np.sum((x - 2.0) ** 2) g[:] = 2.0 * (x - 2.0) return f x0 = np.array([0.0, 0.0]) optimizer = LBFGS() result = optimizer.minimize(evaluate, x0) print("Optimal x:", result)
Debug
Known issues
gotchaThe library does not support Python 3.10+ out of the box due to missing C extension compilation. Users may need to install from source or use a conda-forge build.
fix
Prefer using scipy.optimize.minimize with method='L-BFGS-B' as a more maintained alternative.
affects: >=0.2.0.16
deprecatedThe library is effectively unmaintained; the last release was in 2017. No updates for compatibility with modern Python or NumPy.
fix
Consider switching to scipy.optimize (L-BFGS-B) or pyLBFGS (note different casing: pylbfgs vs pyLBFGS).
affects: all
gotchaThe evaluate function must modify the gradient array in-place; failing to do so leads to incorrect optimization.
fix
Always assign g[:] = ... or use numpy's in-place operations like np.copyto(g, ...).
affects: all
Upgrade
Version history
0.2.0.16latest on PyPI · released Jun 20, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
pylbfgs — pip install pylbfgs · libregistry