I’m trying to install cvxpy using pip install
but am running into an error when preparing the metadata. My current Python version is 3.13.0, and I am on Windows 11. Note that I do not have Conda.
Below is the error I encounter:
C:Usersdevap>pip install cvxpy
Collecting cvxpy
Using cached cvxpy-1.6.0-cp313-cp313-win_amd64.whl.metadata (9.4 kB)
Collecting osqp>=0.6.2 (from cvxpy)
Using cached osqp-0.6.7.post3-cp313-cp313-win_amd64.whl.metadata (2.0 kB)
Collecting clarabel>=0.5.0 (from cvxpy)
Using cached clarabel-0.9.0-cp37-abi3-win_amd64.whl.metadata (4.8 kB)
Collecting scs>=3.2.4.post1 (from cvxpy)
Using cached scs-3.2.7.tar.gz (1.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
+ meson setup C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671 C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671.mesonpy-uwreejb1 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671.mesonpy-uwreejb1meson-python-native-file.ini
The Meson build system
Version: 1.6.0
Source dir: C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671
Build dir: C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671.mesonpy-uwreejb1
Build type: native build
WARNING: Project does not target a minimum version but uses feature introduced in '1.1': meson.options file. Use meson_options.txt instead
Project name: scs
Project version: undefined
Activating VS 17.12.2
C compiler for the host machine: cl (msvc 19.42.34435 "Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34435 for x64")
C linker for the host machine: link link 14.42.34435.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python found: YES (C:UsersdevapAppDataLocalProgramsPythonPython313python.exe)
Library openblas found: NO
Did not find pkg-config by name 'pkg-config'
Found pkg-config: NO
Found CMake: C:Program Files (x86)Microsoft Visual Studio2022BuildToolsCommon7IDECommonExtensionsMicrosoftCMakeCMakebincmake.EXE (3.29.5)
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
Run-time dependency openblas found: NO (tried pkgconfig and cmake)
Library blas found: NO
Run-time dependency blas found: NO (tried pkgconfig and cmake)
Library lapack found: NO
Run-time dependency lapack found: NO (tried pkgconfig and cmake)
Library cblas found: NO
Run-time dependency cblas found: NO (tried pkgconfig and cmake)
..meson.build:48:4: ERROR: Problem encountered: OpenBLAS or Netlib BLAS/CBLAS is required on all platforms except Windows, and was not found.
A full log can be found at C:UsersdevapAppDataLocalTemppip-install-93vr0jcnscs_5d6757b4a018456a9eafc172d72fa671.mesonpy-uwreejb1meson-logsmeson-log.txt
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
I tried doing pip install meson
thinking that it would solve the issue with the "Project does not target a minimum version but uses feature introduced in ‘1.1’" error, but that didn’t help. I’ve also installed Build Tools as per the guide here: cvxpy_guide. It seems to be erroring when trying to install SCS, but I am unsure of what to do to actually fix this issue.
2
Answers
Ultimately, I just used
conda
to installcvxpy
. Not too sure what was wrong with trying to installscs
; I kept on running into the following error even after installing OpenBlas/Blas/etc. and making sure everything is up-to-date (pip
,meson
,numpy
,scipy
, etc.). For some reason,pkgconfig
andcmake
weren't able to detectOpenBlas
:You have to install OpenBLAS in Windows too. Since you don’t have Conda you have to get the official binary packages for your Windows version in the releases section of the GitHub project page.
This link explains how to install. Here are the instructions:
I noticed that you have Visual Studio 2022, so you can use vcpkg package manager to install OpenBLAS more easily. In VS setup ensure vcpkg component is checked and it will be installed.
Then install OpenBLAS: