Question

I am trying to install matplotlib on my machine with OS X 10.8 and XCode 5.0.2. I get these weird errors of which I am not able to make sense. I used pip install matplotlib to install the package, but then it returns the following errors at the end. I am clueless on what to do. Please help me proceed. I tried to install scipy through the same process and the same error stream prevails.

building 'rootfind' library

compiling C sources

C compiler: clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe



creating build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros

compile options: '-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c'

clang: scipy/optimize/Zeros/bisect.c

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: Command "clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -c scipy/optimize/Zeros/bisect.c -o build/temp.macosx-10.8-intel-2.7/scipy/optimize/Zeros/bisect.o" failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip-u0HK_Y-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/v3/xf03tznj5hn9mj7j_4jbkvw40000gn/T/pip_build_Siva/scipy

After this I set the ARCHFLAGS variable to the following

export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

Although the installatoion proceeds a bit further, I get an error stream at a different point now.

running build_ext

building 'matplotlib.ft2font' extension

creating build/temp.macosx-10.8-intel-2.7

creating build/temp.macosx-10.8-intel-2.7/src

creating build/temp.macosx-10.8-intel-2.7/CXX

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.8-intel-2.7/src/ft2font.o

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'clang' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZU81yE-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/matplotlib
Was it helpful?

Solution

That's a common problem, the last macos updates make clang generate errors instead of warnings for unknown compiler options. As a temporary workaround you could set ARCHFLAGS environment variable, before running pip:

export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

OTHER TIPS

I prefer to use Canopy as a python environment on OS X since it is usually harder to install python packages on a Mac.

You can get it here : https://www.enthought.com/downloads/.

MatPlotLib is installed by default, and many more packages are easier to install after installing Canopy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top