Instantly share code, notes, and snippets.

Embed
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
# http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
# finally
pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev
# Let me know if this works for you! jhghank@gmail.com
@rushter

This comment has been minimized.

rushter commented Nov 4, 2013

Thank you, this solution works for me.

@aabdullah-bos

This comment has been minimized.

aabdullah-bos commented Nov 7, 2013

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.

@goldsmith

This comment has been minimized.

Owner

goldsmith commented Nov 8, 2013

Good catch, it should have been quoted.

@eclipselu

This comment has been minimized.

eclipselu commented Nov 27, 2013

It works, thank you

@oguzhan

This comment has been minimized.

oguzhan commented Nov 30, 2013

thanks !

@TheCorp

This comment has been minimized.

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 - http://fonnesbeck.github.io/ScipySuperpack/

@aa403

This comment has been minimized.

aa403 commented Jan 3, 2014

quick question - which version of numpy does this install?

@fogathmann

This comment has been minimized.

fogathmann commented Mar 14, 2014

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
@svdgraaf

This comment has been minimized.

svdgraaf commented Mar 28, 2014

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

@scw

This comment has been minimized.

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.

@llvll0hsen

This comment has been minimized.

llvll0hsen commented Apr 18, 2014

I have some problem with Cpython . any got any solution:
Searching for cython
Reading http://pypi.python.org/simple/cython/
Best match: Cython 0.20.1
Downloading https://pypi.python.org/packages/source/C/Cython/Cython-0.20.1.tar.gz#md5=52431696c64e618036537c4d9aa79d99
Processing Cython-0.20.1.tar.gz
Running Cython-0.20.1/setup.py -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

@goldsmith

This comment has been minimized.

Owner

goldsmith commented Apr 18, 2014

try this?

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

This comment has been minimized.

entryword commented Jun 24, 2015

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