$npx skillfedfor your agent

lmfit

Least-Squares Minimization with Bounds and Constraints

Worth itPyPI Scientific/EngineeringReleased Jul 2025867.3K downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — lmfit-1.3.4-py3-none-any.whl
v1.3.4 · released 2025-07-19 · Python >=3.9 · 5 runtime deps: asteval, numpy, scipy, uncertainties, dill

Yes. Lmfit is stable, permissively licensed, and widely used for scientific curve fitting. Install friction is low and it has no known vulnerabilities. The 391-day release gap suggests aging maintenance rather than active development, so treat it as a mature tool rather than one receiving frequent feature updates—but that's appropriate for a well-established optimization library. Install if you need flexible, named-parameter fitting with bounds and constraints.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9 or later; scipy and numpy must be installed first as core dependencies.
  • Low friction: pure Python wheel with five runtime dependencies (numpy, scipy, asteval, uncertainties, dill).
  • Last release 391 days ago marks aging maintenance, but the package is stable and widely used.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

last release 2025-07-19 (391 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 867,327 downloads/mo, #4,855 on PyPI

Verify before relying

pip install lmfit

import lmfit
params = lmfit.create_params(amp=1.2, cen={'value': 40, 'vary': False}, wid={'value': 4, 'min': 0})
result = lmfit.minimize(objective_func, params, args=(x_data, y_data))
  • Whether the package actively accepts contributions or is in maintenance-only mode given the 391-day release gap.
  • Performance characteristics when fitting models with hundreds or thousands of parameters.
Same gist for agents: .md · .json

What it is and what it does

Lmfit wraps scipy's optimization routines to make curve fitting and least-squares minimization more accessible and flexible. Instead of passing raw arrays to an optimizer, you define named Parameters with optional bounds, fixed values, and mathematical constraints linking them together. The library handles the bookkeeping of which parameters vary and which are held constant, so your fitting function stays clean and model-focused rather than optimization-focused.

The package ships with a Model class for common curve-fitting workflows, built-in model functions, and tools to explore confidence intervals and estimate parameter uncertainties even for solvers where scipy doesn't provide them natively. It's built on numpy and scipy, supports multiple optimization algorithms (Levenberg-Marquardt by default, plus Nelder-Mead, differential_evolution, basin-hopping, and others), and is designed for interactive data analysis where you may want to change constraints or fix parameters on the fly.

Use it for

  • Fit spectral lines or peaks to experimental data with bounds on amplitude, center, and width.
  • Constrain model parameters by mathematical expressions (e.g., force FWHM = width × 2.355) without rewriting the objective function.
  • Estimate parameter uncertainties and correlations after fitting, or explore confidence intervals.
  • Build reusable model functions and combine them for complex multi-peak or multi-component fits.
  • Switch between optimization algorithms without changing your model or parameter setup.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Lmfit is stable, permissively licensed, and widely used for scientific curve fitting. Install friction is low and it has no known vulnerabilities. The 391-day release gap suggests aging maintenance rather than active development, so treat it as a mature tool rather than one receiving frequent feature updates—but that's appropriate for a well-established optimization library. Install if you need flexible, named-parameter fitting with bounds and constraints.

Install

lmfit on PyPI

Before you install

Low friction: pure Python wheel with five runtime dependencies (numpy, scipy, asteval, uncertainties, dill). Last release 391 days ago marks aging maintenance, but the package is stable and widely used.

Requires Python 3.9 or later; scipy and numpy must be installed first as core dependencies.

License in practice

BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; attribution required.

Quickstart

pip install lmfit

import lmfit
params = lmfit.create_params(amp=1.2, cen={'value': 40, 'vary': False}, wid={'value': 4, 'min': 0})
result = lmfit.minimize(objective_func, params, args=(x_data, y_data))

Verify before relying

  • Whether the package actively accepts contributions or is in maintenance-only mode given the 391-day release gap.
  • Performance characteristics when fitting models with hundreds or thousands of parameters.

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
5 packages
astevalnumpyscipyuncertaintiesdill
MaintenanceAging 391 days since the last release
First released
Downloads867,327 / month, #4,855 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering

Evidence: lmfit-1.3.4-py3-none-any.whl

Tags

Capabilities
least squares fittingcurve fitting pythonnon-linear minimizationparameter optimization boundsconstrained curve fittingmodel fitting with uncertaintiesscipy optimization wrapper
Topics
curve-fittingoptimizationparameter-constraints
PyPI keywords
curve-fittingleast-squares minimization

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 › “curve fitting python”

  • lmfitLmfit provides non-linear least-squares minimization and curve…
  • pwlfFits continuous piecewise linear functions to data by specifying the…
  • ocp-gordonInterpolates networks of curves into smooth Gordon surfaces using…

Give your agent the search over MCP, or paste the wish link into any chat.

More Scientific/Engineering packages

numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
pandas Worth it
PyPI · Scientific/Engineering · released Jul 2026

pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.

BSD-3-Clausecompiled wheel · 3.11+
769.1Mdownloads / mo
scipy Worth it
PyPI · Libraries · released Jun 2026

scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.

BSD-3-Clausecompiled wheel · 3.12+
449.0Mdownloads / mo
scikit-learn Worth it
PyPI · Software Development · released Jun 2026

scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.

Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.

BSD-3-Clausecompiled wheel · 3.11+
235.5Mdownloads / mo
dill Worth it
PyPI · Software Development · released Jan 2026

dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.

BSD-3-Clausepure Python · 3.9+
208.1Mdownloads / mo
multiprocess Worth it
PyPI · Software Development · released Jan 2026

Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.

Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.

BSD-3-Clausepure Python · 3.9+
202.7Mdownloads / mo

See also iminuit · pwlf · nlopt · directsearch · piecewise-regression · bayesian-optimization · glum · uncertainties · quadprog · optimistix