Search code examples
pythonmacosinstallationcvxpy

How to install cvxpy on Mac M1?


This is the process of installing cvxpy on Mac M1 (since pip install cvxpy is not working directly):

step 1: install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

step 2: install cmake

brew install cmake

step 3: install cvxpy

pip install cvxpy


Solution

  • The cvxpy website has addressed the problem directly. To summarize, there is no problem using pip for versions 1.1.19/1.2.0 and above, as long as:

    1. cmake is installed via Homebrew.
    2. ECOS version 2.0.5 is installed (as of 23.09.22, more recent version seem to generate issues).

    Here are the steps to install cvxpy on Mac M1:

    step 1: install Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    step 2: install cmake

    brew install cmake

    step 3: install cvxpy

    pip install cvxpy