cvxpy: `cvxpy` fails to install on Python 3.12

Describe the bug

Running pip install cvxpy fails when using Python 3.12

To Reproduce

conda create -n py312-cvxpy python=3.12
conda activate py312-cvxpy
pip install cvxpy

Output Screen Shot 2023-10-23 at 12 09 34

Version

  • OS: macOS
  • CVXPY Version: latest

Additional context

  • I checked and it works fine using Python 3.11
  • I’m using an M1 mac.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I think that leaves qdldl as the only dependency without wheels for Python 3.12. I think it might have less demanding build time dependencies so maybe it is easy to pip install cvxpy on 3.12 now. Still I opened a PR to help enable wheel builds for 3.12 for qdldl here: https://github.com/osqp/qdldl-python/pull/37.

Thanks @RoyiAvital. So scs is okay now, but qdldl (dependency of osqp which is a dependency of cvxpy) still has no wheel for Python 3.12. So the next step would be to ask if wheels for 3.12 could be added at https://github.com/osqp/qdldl-python. There is a conda-forge package for qdldl for Python 3.12 so it should be compatible.

(Alternatively you could try to set up the build system to build from source by installing cmake).

qdldl wheels are up.

We just released a patch that includes wheels for 3.12: https://pypi.org/project/cvxpy/1.4.3/

Feel free to reopen if there are any remaining issues that we should take a look at with 3.12.

@wshanks , Even on conda-forge the install won’t work (Though tried at the beginning of April).

if you are in a hurry, you can grab the .whl from here (minus one patch in waiting) https://github.com/cvxpy/cvxpy/actions/runs/8604826651/job/23580091820

With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 1004790
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 7363d69e3816d785985b83[23](https://github.com/cvxpy/cvxpy/actions/runs/8604826651/job/23580091820#step:12:24)47ae939e03c091a18a7b618e816dee1180c633b1
Finalizing artifact upload
Artifact wheels-base-windows-2022-3.12.zip successfully finalized. Artifact ID 1395275020
Artifact wheels-base-windows-2022-3.12 has been successfully uploaded! Final size is 1004790 bytes. Artifact ID is 1395275020
Artifact download URL: https://github.com/cvxpy/cvxpy/actions/runs/86048[26](https://github.com/cvxpy/cvxpy/actions/runs/8604826651/job/23580091820#step:12:27)651/artifacts/1395275020

@phschiele I noticed that you commented here that cvxpy will release this month with wheels for Python 3.12. I was curious if there was any overlap between the cvxpy and osqp teams to help get 3.12 wheels of qdldl released as well to allow installing cvxpy on 3.12 without building anything locally.

Having cvxpy-1.4.2 wheels on pypi for Python-3.12 would have been nice.

@enzbus https://github.com/conda-forge/scs-feedstock/pull/38 added scs 3.2.4 to conda-forge. 3.2.4 adds Python 3.12 support but it was not built in that PR. There is a follow up PR, https://github.com/conda-forge/scs-feedstock/pull/40, adding the 3.12 build. Still, the 3.12 build should be available from conda-forge in the next couple hours (once that PR finishes building and gets seeded to the CDN).

I could install cvxpy1.4.2 in Python 3.12 via pip install cvxpy==1.4.2 now (Windows 11). Though conda install -c conda-forge cvxpy didn’t work.