When I run "pip install cvxpy" I get the following error:

Collecting osqp>=0.6.2 (from cvxpy)

  Using cached osqp-0.6.3.tar.gz (228 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [115 lines of output]
      Collecting oldest-supported-numpy
        Using cached oldest_supported_numpy-2023.10.25-py3-none-any.whl.metadata (9.8 kB)
      Collecting setuptools>=40.8.0
        Using cached setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
      Collecting wheel
        Using cached wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
      Collecting setuptools_scm>=6.2
        Using cached setuptools_scm-8.0.4-py3-none-any.whl.metadata (6.4 kB)
      Collecting qdldl
        Using cached qdldl-0.1.7.post0.tar.gz (70 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Installing backend dependencies: started
        Installing backend dependencies: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting numpy==1.26.1 (from oldest-supported-numpy)
        Using cached numpy-1.26.1-cp312-cp312-win_amd64.whl.metadata (61 kB)
      Collecting packaging>=20 (from setuptools_scm>=6.2)
        Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
      Collecting typing-extensions (from setuptools_scm>=6.2)
        Using cached typing_extensions-4.8.0-py3-none-any.whl.metadata (3.0 kB)
      Collecting scipy>=0.13.2 (from qdldl)
        Using cached scipy-1.11.3-cp312-cp312-win_amd64.whl.metadata (60 kB)
      Using cached oldest_supported_numpy-2023.10.25-py3-none-any.whl (4.9 kB)
      Using cached numpy-1.26.1-cp312-cp312-win_amd64.whl (15.5 MB)
      Using cached setuptools-68.2.2-py3-none-any.whl (807 kB)
      Using cached wheel-0.41.2-py3-none-any.whl (64 kB)
      Using cached setuptools_scm-8.0.4-py3-none-any.whl (42 kB)
      Using cached packaging-23.2-py3-none-any.whl (53 kB)
      Using cached scipy-1.11.3-cp312-cp312-win_amd64.whl (43.7 MB)
      Using cached typing_extensions-4.8.0-py3-none-any.whl (31 kB)
      Building wheels for collected packages: qdldl
        Building wheel for qdldl (pyproject.toml): started
        Building wheel for qdldl (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        Building wheel for qdldl (pyproject.toml) did not run successfully.
        exit code: 1

        [66 lines of output]
        running bdist_wheel
        running build
        running build_ext
        Traceback (most recent call last):
          File "<frozen runpy>", line 198, in _run_module_as_main
          File "<frozen runpy>", line 88, in _run_code
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Scripts\cmake.exe\__main__.py", line 4, in <module>
        ModuleNotFoundError: No module named 'cmake'
        Traceback (most recent call last):
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
            main()
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
            return _build_backend().build_wheel(wheel_directory, config_settings,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel
            return self._build_with_temp_dir(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir
            self.run_setup()
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
            exec(code, locals())
          File "<string>", line 113, in <module>
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
            return run_commands(dist)
                   ^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
            dist.run_commands()
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
            self.run_command(cmd)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
            super().run_command(command)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
            cmd_obj.run()
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\normal\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run
            self.run_command("build")
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
            self.distribution.run_command(command)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
            super().run_command(command)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
            cmd_obj.run()
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
            self.run_command(cmd_name)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
            self.distribution.run_command(command)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command
            super().run_command(command)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
            cmd_obj.run()
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 88, in run
            _build_ext.run(self)
          File "C:\Users\joost\AppData\Local\Temp\pip-build-env-_l_up0bd\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
            self.build_extensions()
          File "<string>", line 81, in build_extensions
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 466, in check_output
            return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\joost\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 571, in run
            raise CalledProcessError(retcode, process.args,
        subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
        [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for qdldl
      Failed to build qdldl
      ERROR: Could not build wheels for qdldl, which is required to install pyproject.toml-based projects
      [end of output]

I already re-installed cmake and pip itself. I also tried several solutions I found online (such as downloading the visual studio c++ build tools) but nothing worked. If I run cmake --version it works corrrectly and I can import cmake in a notebook.

1

There are 1 best solutions below

0
On

I still do not know what caused this problem, but I managed to make it work in the end.

I uninstalled python and installed an earlier version (3.11). I then manually downloaded the corresponding osqp version (with cp311) and ran

pip install osqp-0.6.3-cp311-cp311-win_amd64.whl

in the directory of my download to install osqp. With this dependency covered I could finally install cvxpy the normal way

pip install cvxpy

To me it just seems as if the newer version of python is incompatible with 'something' involved with installing osqp