osqp/osqp-python

Error in building wheel for osqp because "No module named cmake' "

jaimiosyncrasy opened this issue · 1 comments

I'm trying to install the cvxpy package in my virtual environment of PyCharm. I typed C:\Users\<Username>\PycharmProjects\<projectName>\venv\Scripts>pip install cvxpy, and got:

Collecting cvxpy
  Using cached cvxpy-1.2.1-cp311-cp311-win_amd64.whl
Collecting ecos>=2
  Using cached ecos-2.0.10-cp311-cp311-win_amd64.whl
Collecting osqp>=0.4.1
  Using cached osqp-0.6.2.post5.tar.gz (226 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.15 in c:\users\<Username>\PycharmProjects\<projectName>\venv\lib\site-packages (from cvxpy) (1.23.4)
Collecting scs>=1.1.6
  Using cached scs-3.2.0-cp311-cp311-win_amd64.whl
Requirement already satisfied: scipy>=1.1.0 in c:\users\<Username>\PycharmProjects\<projectName>\venv\lib\site-packages (from cvxpy) (1.9.3)
Collecting qdldl
  Using cached qdldl-0.1.5.post2-cp311-cp311-win_amd64.whl
Building wheels for collected packages: osqp
  Building wheel for osqp (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\<Username>\PycharmProjects\<projectName>\venv\Scripts\python.exe' 'C:\Users\<Username>\PycharmProjects\<projectName>\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\<Username>\AppD
ata\Local\Temp\tmptb8bjomi'
       cwd: C:\Users\<Username>\AppData\Local\Temp\pip-install-6glakjuq\osqp_f4f485f728cb41eb9bd04d39cf2e5c81
  Complete output (82 lines):
  Disabling LONG
  Remove long integers for numpy compatibility. See:
   - https://github.com/numpy/numpy/issues/5906
   - https://github.com/ContinuumIO/anaconda-issues/issues/3823
  You can reenable long integers by passing: --osqp --long argument.

  running bdist_wheel
  running build
  running build_py
  running egg_info
  writing src\osqp.egg-info\PKG-INFO
  writing dependency_links to src\osqp.egg-info\dependency_links.txt
  writing requirements to src\osqp.egg-info\requires.txt
  writing top-level names to src\osqp.egg-info\top_level.txt
  listing git files failed - pretending there aren't any
  reading manifest file 'src\osqp.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  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\<Username>\PycharmProjects\<projectName>\venv\Scripts\cmake.exe\__main__.py", line 4, in <module>     
  ModuleNotFoundError: No module named 'cmake'
.
.
.
  subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
  ----------------------------------------

  ERROR: Failed building wheel for osqp


Trying C:\Users\<Username>>pip install cvxpy does successfuly install cvxpy, but then cvxpy isn't in my virtual environment. I tried uninstalling cmake and then installing cvxpy - didn't work. I uninstalled and reinstalled cmake and didn’t work.
cmake version is the latest, ver 3.24.1, obtained from running pip install cmake
python version is 3.11.0, pip version is 21.3.1.

Update: this has been resolved by uninstalling python version 3.11.0 and installing python version 3.10.7. This page suggested that OSQP developers have validated the build wheels properly for 3.10. So maybe they havn't done that for 3.11 yet.