Skip to main content

PyProximal

PyPI version AzureDevOps Status GithubAction Status Documentation Status OS-support Slack Status DOI

Objective

This Python library provides all the needed building blocks for solving non-smooth convex optimization problems using the so-called proximal algorithms.

Whereas gradient based methods are first-order iterative optimization algorithms for solving unconstrained, smooth optimization problems, proximal algorithms can be viewed as an analogous tool for non-smooth and possibly constrained versions of these problems. Such algorithms sit at a higher level of abstraction than classical algorithms like Steepest descent or Newton’s method and require a basic operation to be performed at each iteration: the evaluation of the so-called proximal operator of the functional to be optimized.

Whilst evaluating a proximal operator does itself require solving a convex optimization problem, these subproblems often admit closed form solutions or can be solved very quickly with ad-hoc specialized methods. Several of such proximal operators are therefore implemented in this library.

Here is a simple example showing how to compute the proximal operator of the L1 norm of a vector:

import numpy as np
from pyproximal import L1

l1 = L1(sigma=1.)
x = np.arange(-5, 5, 0.1)
xp = l1.prox(x, 1)

and how this can be used to solve a basic denoising problem of the form: min ||x - y||_2^2 + ||Dx||_1:

import numpy as np
from pylops import FirstDerivative
from pyproximal import L1, L2
from pyproximal.optimization.primal import LinearizedADMM

np.random.seed(1)

# Create noisy data
nx = 101
x = np.zeros(nx)
x[:nx//2] = 10
x[nx//2:3*nx//4] = -5
n = np.random.normal(0, 2, nx)
y = x + n

# Define functionals
l2 = L2(b=y)
l1 = L1(sigma=5.)
Dop = FirstDerivative(nx, edge=True, kind='backward')

# Solve functional with L-ADMM
L = np.real((Dop.H * Dop).eigs(neigs=1, which='LM')[0])
tau = 1.
mu = 0.99 * tau / L
xladmm, _ = LinearizedADMM(l2, l1, Dop, tau=tau, mu=mu,
                           x0=np.zeros_like(x), niter=200)

Why another library for proximal algorithms?

Several other projects in the Python ecosystem provide implementations of proximal operators and/or algorithms, which present some clear overlap with this project.

A (possibly not exhaustive) list of other projects is:

All of these projects are self-contained, meaning that they implement both proximal and linear operators as needed to solve a variety of problems in different areas of science.

The main difference with PyProximal lies in the fact that we decide not to intertangle linear and proximal operators within the same library. We leverage the extensive set of linear operators provided by the PyLops project and focus only on the proximal part of the problem. This makes the codebase more concise, and easier to understand and extend. Moreover many of the problems that are solved in PyLops can now be also solved by means of proximal algorithms!

Project structure

This repository is organized as follows:

  • pyproximal: python library containing various orthogonal projections, proximial operators, and solvers
  • pytests: set of pytests
  • testdata: sample datasets used in pytests and documentation
  • docs: sphinx documentation
  • examples: set of python script examples for each proximal operator to be embedded in documentation using sphinx-gallery
  • tutorials: set of python script tutorials to be embedded in documentation using sphinx-gallery

Getting started

You need Python 3.10 or greater.

From PyPI

To get the most out of PyProximal straight out of the box, we recommend using the PyPI distribution via uv:

uv pip install pyproximal

or directly via pip:

pip install pyproximal

From Conda

You can also install PyProximal via conda:

conda install -c conda-forge pyproximal

From Github

Finally, you can also directly install from the main branch (although this is not recommended) via uv:

uv add git+https://github.com/PyLops/pyproximal.git --branch main

or via pip:

pip install git+https://git@github.com/PyLops/pyproximal.git@main

Contributing

Feel like contributing to the project? Adding new operators or tutorial?

We advise using the Anaconda Python distribution to ensure that all the dependencies are installed via the Conda package manager. Follow the following instructions and read carefully the CONTRIBUTING file before getting started.

1. Fork and clone the repository

Execute the following command in your terminal:

git clone https://github.com/your_name_here/pyproximal.git

2. Install PyProximal in a new Conda environment

To ensure that further development of PyProximal is performed within the same environment (i.e., same dependencies) as that defined by environment-dev.yml/environment-dev-arm.yml files, we suggest to work off a new Conda enviroment.

The first time you clone the repository run the following command:

make dev-install_conda

To ensure that everything has been setup correctly, run tests:

make tests

Make sure no tests fail, this guarantees that the installation has been successfull.

Remember to always activate the conda environment every time you open a new terminal by typing:

source activate pyproximal

If you prefer to use uv, checkout the Contributing page in the official documentation.

Documentation

The official documentation of PyProximal is available here.

Moreover, if you have installed PyProximal using the developer environment you can also build the documentation locally by typing the following command:

make doc

Once the documentation is created, you can make any change to the source code and rebuild the documentation by simply typing

make docupdate

Note that if a new example or tutorial is created (and if any change is made to a previously available example or tutorial) you are required to rebuild the entire documentation before your changes will be visible.

Citing

When using PyProximal in scientific publications, please cite the following paper:

  • Ravasi M, Örnhag M. V., Luiken N., Leblanc O. and Uruñuela E., 2024, PyProximal - scalable convex optimization in Python, Journal of Open Source Software, 9(95), 6326. doi: 10.21105/joss.06326 (link)

Contributors

  • Matteo Ravasi, mrava87
  • Nick Luiken, NickLuiken
  • Eneko Uruñuela, eurunuela
  • Marcus Valtonen Örnhag, marcusvaltonen
  • Olivier Leblanc, olivierleblanc
  • Toru Tamaki, tttamaki

Release files for pyproximal 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyproximal 0.12.0
File Size Uploaded
pyproximal-0.12.0.tar.gz 359.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyproximal 0.12.0
File Interpreter ABI Platform
pyproximal-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 473.6 kB

Release files / pyproximal-0.12.0.tar.gz

Download URL pyproximal-0.12.0.tar.gz
Size 359.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3979e042c5324bbaaf4e19e80102cee6604a5eceec6350cdbe0445f4ccf1458
BLAKE2b-256 checksum
How to use checksums
68cf5dca9c5e1d292969cda65e0a8e14cd2071a3c781157214ad619044f818c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Release files / pyproximal-0.12.0-py3-none-any.whl

Download URL pyproximal-0.12.0-py3-none-any.whl
Size 114.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b84ba73404c4428c64867a1b6079bb1f87718209d5f41e2eb17f71d47dcfde8f
BLAKE2b-256 checksum
How to use checksums
3ba1cbebf2a0d96b01a855b71941675542a57fc1791540ada591e2da5f2ee527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page