{"id":24343,"library":"pylbfgs","title":"PyLBFGS","description":"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.","status":"maintenance","version":"0.2.0.16","language":"python","source_language":"en","source_url":"https://github.com/dedupeio/pylbfgs","tags":["optimization","L-BFGS","OWL-QN","numerical optimization","machine learning"],"install":[{"cmd":"pip install pylbfgs","lang":"bash","label":"Latest from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"LBFGS","correct":"from pylbfgs import LBFGS"},{"note":"","wrong":"","symbol":"owl_qn","correct":"from pylbfgs import owl_qn"}],"quickstart":{"code":"import numpy as np\nfrom pylbfgs import LBFGS\n\ndef evaluate(x, g):\n    # f(x) = (x-2)^2, gradient = 2*(x-2)\n    f = np.sum((x - 2.0) ** 2)\n    g[:] = 2.0 * (x - 2.0)\n    return f\n\nx0 = np.array([0.0, 0.0])\noptimizer = LBFGS()\nresult = optimizer.minimize(evaluate, x0)\nprint(\"Optimal x:\", result)\n","lang":"python","description":"Minimize a simple quadratic function using L-BFGS."},"warnings":[{"fix":"Prefer using scipy.optimize.minimize with method='L-BFGS-B' as a more maintained alternative.","message":"The 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.","severity":"gotcha","affected_versions":">=0.2.0.16"},{"fix":"Consider switching to scipy.optimize (L-BFGS-B) or pyLBFGS (note different casing: pylbfgs vs pyLBFGS).","message":"The library is effectively unmaintained; the last release was in 2017. No updates for compatibility with modern Python or NumPy.","severity":"deprecated","affected_versions":"all"},{"fix":"Always assign g[:] = ... or use numpy's in-place operations like np.copyto(g, ...).","message":"The evaluate function must modify the gradient array in-place; failing to do so leads to incorrect optimization.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install pylbfgs","cause":"pylbfgs is not installed or the package name is confused with similar libraries (e.g., pyLBFGS).","error":"ImportError: No module named pylbfgs"},{"fix":"Use a conda environment or install from a precompiled wheel if available. Alternatively, use scipy.","cause":"Windows DLL missing; the C extension may not be compiled correctly for your Python version.","error":"OSError: [WinError 126] The specified module could not be found"},{"fix":"Ensure evaluate returns a float or numpy scalar. Check the function signature.","cause":"Typo in evaluate function: returning a float instead of a callable? Actually this error occurs when the objective function does not return the function value correctly.","error":"TypeError: 'numpy.float64' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}