DanielBok/nlopt-python

A project to package the NLOpt library to wheels

Python

34

111 commits

updated Aug 11, 2026

See the code

README

NLopt Python

PyPI version PyPI downloads Python versions License Build Nightly Build Documentation

Python wheels for NLopt, a library for nonlinear optimization. NLopt provides a common interface to a large collection of optimization algorithms, both global and local, gradient-based and derivative-free, for constrained or unconstrained problems.

This project exists to make installing NLopt in Python as simple as pip install nlopt — no compiler, SWIG, or system NLopt installation required. Prebuilt wheels are published for Windows, macOS, and Linux.

Installation

pip install nlopt

Prebuilt wheels are available for Python 3.10+ on Windows, macOS, and Linux (x86_64 and arm64). If no matching wheel is found for your platform, pip will fall back to building from source, which requires SWIG and a C++ compiler.

Usage

import nlopt
import numpy as np

def objective(x, grad):
    return x[0] ** 2 + x[1] ** 2

opt = nlopt.opt(nlopt.LN_COBYLA, 2)
opt.set_min_objective(objective)
opt.set_lower_bounds([-10, -10])
opt.set_upper_bounds([10, 10])
opt.set_xtol_rel(1e-6)

x = opt.optimize(np.array([1.0, 1.0]))
print(f"Minimum found at {x}, value = {opt.last_optimum_value()}")

Documentation

Full API documentation, including the list of supported algorithms, is available at nlopt.readthedocs.io.

Releases

Builds run nightly and publish dev versions to TestPyPI so regressions surface before a real release. Stable releases are cut from tagged GitHub Releases and published to PyPI. The vendored extern/nlopt submodule is checked daily against upstream and bumped automatically via PR when a new NLopt version is released.

License

This project wraps NLopt, whose underlying routines are covered by a mix of licenses (mainly MIT and LGPL) depending on the algorithm — see LICENSE for details. The Python packaging in this repository is licensed under MIT.

nlopt
non-linear-optimization
optimization
python

DanielBok/nlopt-python

A project to package the NLOpt library to wheels

Python

34

111 commits

updated Aug 11, 2026

See the code

README

NLopt Python

PyPI version PyPI downloads Python versions License Build Nightly Build Documentation

Python wheels for NLopt, a library for nonlinear optimization. NLopt provides a common interface to a large collection of optimization algorithms, both global and local, gradient-based and derivative-free, for constrained or unconstrained problems.

This project exists to make installing NLopt in Python as simple as pip install nlopt — no compiler, SWIG, or system NLopt installation required. Prebuilt wheels are published for Windows, macOS, and Linux.

Installation

pip install nlopt

Prebuilt wheels are available for Python 3.10+ on Windows, macOS, and Linux (x86_64 and arm64). If no matching wheel is found for your platform, pip will fall back to building from source, which requires SWIG and a C++ compiler.

Usage

import nlopt
import numpy as np

def objective(x, grad):
    return x[0] ** 2 + x[1] ** 2

opt = nlopt.opt(nlopt.LN_COBYLA, 2)
opt.set_min_objective(objective)
opt.set_lower_bounds([-10, -10])
opt.set_upper_bounds([10, 10])
opt.set_xtol_rel(1e-6)

x = opt.optimize(np.array([1.0, 1.0]))
print(f"Minimum found at {x}, value = {opt.last_optimum_value()}")

Documentation

Full API documentation, including the list of supported algorithms, is available at nlopt.readthedocs.io.

Releases

Builds run nightly and publish dev versions to TestPyPI so regressions surface before a real release. Stable releases are cut from tagged GitHub Releases and published to PyPI. The vendored extern/nlopt submodule is checked daily against upstream and bumped automatically via PR when a new NLopt version is released.

License

This project wraps NLopt, whose underlying routines are covered by a mix of licenses (mainly MIT and LGPL) depending on the algorithm — see LICENSE for details. The Python packaging in this repository is licensed under MIT.

nlopt
non-linear-optimization
optimization
python

Project health

Overall

4.4/10

Maintained

10/10

Code review

2/10
OpenSSF Scorecard

PyPI

Latest release

2.11.0 · Jul 17, 2026

Releases this year

2

Significant stargazers

Agriya Khetarpal

163 followers · starred Sep 2024