cvxpy stlibc++ Installation error on MacOS Mojave
Asked Answered
N

3

6

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.

Nellnella answered 28/10, 2018 at 15:35 Comment(0)
T
11

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.

Technique answered 15/12, 2018 at 6:4 Comment(0)
C
1

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
Colner answered 28/10, 2018 at 23:52 Comment(4)
Thanks. But I am not using anaconda distribution. I am facing issues in pip installation of cvxpy.Nellnella
Updated Mac OS Command Line Tools to version 10.1. After the update pip install cvxpy installation worked like a charm.Nellnella
Using CFLAGS=-stdlib=libc++ before pip install cvxpy like CFLAGS=-stdlib=libc++ pip install cvxpy might also work.Nellnella
This worked for me for building fancyimpute on OS X 10.14!Arleanarlee
C
0

I had a similar error on Mojave. The problem is that the location of the headers installed by XCode command-line tools (which includes clang) have changed. I was able to get it working by adding this to my ~/.bash_profile and opening a new shell:

export CFLAGS="-I/usr/local/include -L/usr/local/lib -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include"

This adds flags to CLANG that tell it to run the xcrun command to find the headers. It also adds the homebrew openssl headers to the clang path, which may not be necessary for this case (and assumes you have them installed).

See: https://mcmap.net/q/748612/-brew-install-on-mojave

Cockade answered 1/11, 2018 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.