cvxpy / cvxpy

A Python-embedded modeling language for convex optimization problems.

Home Page:https://www.cvxpy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`cvxpy` cannot be imported in python 3.12

jlopezpena opened this issue · comments

Is there a plan to make a new release soon? Even if it can be installed with python 3.12, version 1.4.2 cannot be used there due to syntax errors in some docstrings. This error shows up when pytest tries to collect tests in our codebase:

import cvxpy as cp
.venv/lib/python3.12/site-packages/cvxpy/__init__.py:57: in <module>
    from cvxpy.problems.problem import Problem as Problem
.venv/lib/python3.12/site-packages/cvxpy/problems/problem.py:38: in <module>
    from cvxpy.reductions import InverseData
.venv/lib/python3.12/site-packages/cvxpy/reductions/__init__.py:24: in <module>
    from cvxpy.reductions.dcp2cone.dcp2cone import Dcp2Cone
.venv/lib/python3.12/site-packages/cvxpy/reductions/dcp2cone/dcp2cone.py:24: in <module>
    from cvxpy.reductions.dcp2cone.canonicalizers import CANON_METHODS as cone_canon_methods
.venv/lib/python3.12/site-packages/cvxpy/reductions/dcp2cone/canonicalizers/__init__.py:44: in <module>
    from cvxpy.reductions.dcp2cone.canonicalizers.suppfunc_canon import (
.venv/lib/python3.12/site-packages/cvxpy/reductions/dcp2cone/canonicalizers/suppfunc_canon.py:5: in <module>
    from cvxpy.reductions.solvers.conic_solvers.scs_conif import (
.venv/lib/python3.12/site-packages/cvxpy/reductions/solvers/conic_solvers/__init__.py:34: in <module>
    from .sdpa_conif import SDPA
E     File "/__w/growth/growth/.venv/lib/python3.12/site-packages/cvxpy/reductions/solvers/conic_solvers/sdpa_conif.py", line 136
E       """
E       ^^^
E   SyntaxError: invalid escape sequence '\i'

I can see that the issue is already fixed in main, but no release has been made since. Could a patch version get release to get around the issue?

A patch is imminent (next few days).

The latest release (https://pypi.org/project/cvxpy/1.4.3/) includes the fix (#2351).