skillfed

nlopt

Library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization

nlopt v2.11.0 1.1M downloads/30d#4,392 on PyPI33
Permissive license MIT Active released

What it is and what it does

NLopt is a Python wrapper around the NLopt C library, providing access to a collection of non-linear optimization algorithms. It handles both constrained and unconstrained problems, with support for global and local search methods. The package depends only on numpy and is distributed as pre-compiled wheels for modern Python versions on Windows, macOS, and Linux.

Developers use NLopt when they need to solve optimization problems that don't fit standard linear or convex frameworks—fitting parameters to data, tuning hyperparameters, or finding optimal configurations subject to constraints. The library abstracts away algorithm selection and convergence details, allowing you to specify an objective function and let NLopt handle the numerical work.

Use it for:

  • Fit model parameters to experimental data by minimizing the difference between predictions and observations
  • Tune hyperparameters in machine learning or simulation models subject to bounds and constraints
  • Solve engineering design problems where you need to optimize multiple objectives or handle non-convex search spaces
  • Find equilibrium points or optimal configurations in physical systems with complex constraint relationships

Worth the install?

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

NLopt provides Python bindings to the NLopt library, offering a suite of algorithms for solving non-linear optimization problems with global, local, constrained, and unconstrained variants.

Yes. NLopt is actively maintained, carries no known vulnerabilities, uses a permissive MIT license, and provides precompiled wheels that install cleanly on standard platforms. It is a stable, production-grade library for non-linear optimization with a straightforward API. Install it if you need to solve optimization problems beyond the scope of scipy.optimize or other general-purpose solvers.

Install

nlopt on PyPI

pip

pip install nlopt

uv

uv add nlopt

poetry

poetry add nlopt

Installing nlopt

Before you install

Medium install friction due to compiled C++ bindings, but wheels are provided for Python 3.9+ across Windows, macOS, and Linux. Last release was 28 days ago with active repository maintenance.

License in practice

MIT license permits commercial and private use with minimal restrictions; suitable for most projects without licensing concerns.

Quickstart

pip install nlopt

import nlopt
import numpy as np

opt = nlopt.opt(nlopt.LN_COBYLA, 2)
opt.set_min_objective(lambda x, grad: x[0]**2 + x[1]**2)
opt.optimize([1.0, 1.0])

Requires Python 3.9 or later; compiled wheels available for common platforms but may require build tools on unsupported architectures.

Verify before relying

  • Specific algorithm count and performance characteristics compared to other optimization libraries
  • Whether the package includes derivative-free and gradient-based methods or only a subset
  • Support for multi-objective optimization or only single-objective problems

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 28 days since the last release
Last repo commit
First released
Downloads 1,083,574/month — #4,392 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: nlopt-2.11.0-cp310-cp310-macosx_11_0_arm64.whl; nlopt-2.11.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; nlopt-2.11.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; nlopt-2.11.0-cp310-cp310-win_amd64.whl; nlopt-2.11.0-cp311-cp311-macosx_11_0_arm64.whl; nlopt-2.11.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; nlopt-2.11.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; nlopt-2.11.0-cp311-cp311-win_amd64.whl; nlopt-2.11.0-cp312-cp312-macosx_11_0_arm64.whl; nlopt-2.11.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; nlopt-2.11.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; nlopt-2.11.0-cp312-cp312-win_amd64.whl; nlopt-2.11.0-cp313-cp313-macosx_11_0_arm64.whl; nlopt-2.11.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; nlopt-2.11.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; nlopt-2.11.0-cp313-cp313-win_amd64.whl; nlopt-2.11.0-cp314-cp314-macosx_11_0_arm64.whl; nlopt-2.11.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; nlopt-2.11.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; nlopt-2.11.0-cp314-cp314-win_amd64.whl

Keywords: algorithms, global local constrained unconstrained optimization, optimization, non-linear optimization

Development Status :: 5 - Production/StableIntended Audience :: EducationIntended Audience :: End Users/DesktopLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: C++Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Scientific/Engineering

Tags

non-linear optimizationconstrained optimization algorithmsglobal local optimizationmathematical optimization libraryoptimization solver python
optimizationnumerical-methodsscientific-computing

More Scientific/Engineering packages