Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cvxpy stlibc++ Installation error on MacOS Mojave

While trying to install cvxpy package using pip install on Mac, I get the following error message:

warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from cvxpy/cvxcore/src/cvxcore.cpp:15:
cvxpy/cvxcore/src/cvxcore.hpp:18:10: fatal error: 'vector' file not found
#include <vector>
^~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

Mac is running OS Mojave.

like image 887
dheena Avatar asked Oct 28 '18 15:10

dheena


2 Answers

I have been struggling with this all weekend and the most success I have found so far is installing cvxpy in an anaconda environment with these two lines:

conda install -c conda-forge lapack
conda install -c cvxgrp cvxpy
like image 41
L. Buquicchio. Avatar answered Oct 19 '22 02:10

L. Buquicchio.


I solved the issue using the following steps,

First I tried changing the flags to instruct the installation to use libc++,

CFLAGS=-stdlib=libc++ pip install cvxpy

Then it complained about having an invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later).

Then I ran the following command to set the deployment target,

export MACOSX_DEPLOYMENT_TARGET=10.10

Then running the first command(CFLAGS=-stdlib=libc++ pip install cvxpy) again installed cvxpy successfully.

like image 61
Pubudu Dodangoda Avatar answered Oct 19 '22 02:10

Pubudu Dodangoda