Skip to content

Instantly share code, notes, and snippets.

Last active November 2, 2020 10:39
What would you like to do?
How to install Numpy and Scipy on Mac OS X Mavericks (10.9) using Pip.
# set up flags for Numpy C extentions compiling
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
export CC=gcc-4.2
export CXX="g++ -arch i386 -arch x86_64"
pip install numpy
# success!
# now for scipy
easy_install cython
# make sure you have Homebrew
brew install gfortran
# if this is too slow or has an error
# install gfotran from the Mac OS X Lion installer for Intel 64-bit processors
# finally
pip install -e git+
# Let me know if this works for you!
Copy link

rushter commented Nov 4, 2013

Thank you, this solution works for me.

Copy link

This also worked for me. Thanks so much. I did however have to make one change, I had to quote the line that exported CXX:

export CXX="g++ -arch i386 -arch x86_64"

I am pretty sure that I've got other issues, but gcc didn't work for me. I wound up replacing gcc and g++ with clang.

Copy link

Good catch, it should have been quoted.

Copy link

It works, thank you

Copy link

oguzhan commented Nov 30, 2013

thanks !

Copy link

TheCorp commented Jan 2, 2014

This didn't work for me, I ran into issues on the final step with errors like these when compiling

/System/Library/Frameworks/vecLib.framework/Headers/vBasicOps.h:153:23: error: immintrin.h: No such file or directory

Ended up going with this -

Copy link

aa403 commented Jan 3, 2014

quick question - which version of numpy does this install?

Copy link

Excellent, thank you!

On my system (Mavericks 10.9.2 with latest update for Command Line Tools) I had to use

export CC=gcc

rather than

export CC=gcc-4.2

Copy link

@fogathmann 👍 I had the same issue, works like a charm!

Copy link

scw commented Apr 3, 2014

I've been having this same problem, for pretty much any packages which build C/C++ code. I made a small wrapper around this process so that pip gets the right environment directly. It seems to work OK for me, and makes it less annoying to manage the shell variables on a per-session basis.

Copy link

I have some problem with Cpython . any got any solution:
Searching for cython
Best match: Cython 0.20.1
Processing Cython-0.20.1.tar.gz
Running Cython-0.20.1/ -q bdist_egg --dist-dir /tmp/easy_install-P4GGuh/Cython-0.20.1/egg-dist-tmp-SNjzLk
warning: no files found matching '.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '
.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '
.pxd' under directory 'Cython/Utility'
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: Setup script exited with error: command 'cc' failed with exit status 1

Copy link

try this?

export CFLAGS="-arch i386 -arch x86_64 -Qunused-arguments"
export CPPFLAGS="-Qunused-arguments"

Copy link

Thanks a lot!
and thank you @fogathmann it works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment