Python

Python interface supports Python 3.8 or newer.

Pip

Install osqp with the default algebra backend using pip:

pip install osqp

The builtin algebra backend is always available for use. Alternative osqp algebra backends - mkl or cu12 as of the time of this writing, can also be installed:

To install osqp with the mkl backend:

pip install osqp[mkl]

To install osqp with the cu12 (Cuda 12.x) backend:

pip install osqp[cu12]

To install osqp with the mkl and cu12 backends:

pip install osqp[mkl,cu12]

Note

These commands install osqp with the mkl or cu12 “extras”, which provide the osqp-mkl or osqp-cuda packages respectively. These extension modules are directly importable using import osqp_mkl or import osqp_cuda, though you will never directly need to do this.

See Algebra Backends -> Python for more information on how to use these backends.