Search code examples
python-3.xpipubuntu-14.04cvxpy

How to fix a pip install error of osqp for python3.4?


The error looks like the following:

Installing collected packages: osqp
  Running setup.py install for osqp ... error
    ...
    ...
    ...
    copying module/codegen/sources/src/qdldl_interface.c -> build/lib.linux-x86_64-3.4/osqp/codegen/sources/src
    copying module/codegen/sources/src/scaling.c -> build/lib.linux-x86_64-3.4/osqp/codegen/sources/src
    copying module/codegen/sources/src/util.c -> build/lib.linux-x86_64-3.4/osqp/codegen/sources/src
    running build_ext
    CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
      CMake 3.2 or higher is required.  You are running version 2.8.12.2


    -- Configuring incomplete, errors occurred!
    Error: could find generator in Cache
    error: [Errno 2] No such file or directory: 'osqp_sources/build/out/libosqp.a'

    ----------------------------------------
Command "/home/zhongzi/code/.virtualenvs/ml3.4/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-tzdyeutc/osqp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-f76ehs0l/install-record.txt --single-version-externally-managed --compile --install-headers /home/zhongzi/code/.virtualenvs/ml3.4/include/site/python3.4/osqp" failed with error code 1 in /tmp/pip-install-tzdyeutc/osqp/

The system is 14.04.1-Ubuntu. Any help will be appreciated!


Solution

  • Adding the answer here so that the question can be resolved. Update the "cmake" package, for example, in Ubuntu:

    sudo apt-get install cmake
    

    This was indicated by the error output: "CMake 3.2 or higher is required. You are running version 2.8.12.2".