Skip to content

Instantly share code, notes, and snippets.

@stared
Last active December 12, 2015 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stared/4730202 to your computer and use it in GitHub Desktop.
Save stared/4730202 to your computer and use it in GitHub Desktop.
Installing scikit-learn on Mac OS X (including gfortran and scipy)

I had some problems with installing scikit-learn on Mac OS X. I believe that the main problem was at step of installing gfortran (required to install scipy, which is required to install scikit-learn).

I was as of Oct 2012; plus it might have depended on some of my custom settings/configurations.

My starting point:

-5. MacOSX 10.8.1 (Mountain Lion)

-4. XCode 4.5 installed with Command line tools

-3. Homebrew installed http://mxcl.github.com/homebrew/ (thx Kevin for recommending it!)

-2. custom Python 2.6 in /Library/Frameworks/Python.framework/Versions/2.6/bin/python

-1. NumPy and MathPlotLib already there

Steps:

  1. install gfortran with homebrew:

$ brew install gfortran

  1. install SciPy from http://sourceforge.net/projects/scipy/files/ (file scipy-0.11.0-py2.6-python.org-macosx10.3.dmg)

  2. (AFAIR) install sklearn with:

$ sudo env ARCHFLAGS="-arch i386" pip install scikit-learn

Warning/disclaimer:

  • check, but I cannot promise that it is going to work; I did many steps (in vain) in between, and some actually might have influenced the install

  • http://fonnesbeck.github.com/ScipySuperpack/ looks extremely promsing (thx Fariba), and it claimed that it installed succesfully... but it does not work (at least - for me)

  • don't even try installing SciPy with pip or easy_install; you are going to run in almost-baked installs, with some contradictions with respect to architectures (i386 vs x86_64) - it will be installed, but some functions are going to crash, as well as sklearn (vide http://stackoverflow.com/questions/2155986/mac-10-6-universal-binary-scipy-cephes-specfun-aswfa-symbol-not-found)

  • main place for gfortran is down http://r.research.att.com/tools/ (at least, as of now, they claim "NOTE: some links may be broken - we are working on the issue and most of them should be back by the end of Monday (10/15), possibly earlier.")

Looking forward for your feedback!

@tianqig
Copy link

tianqig commented Oct 12, 2013

I tried to follow your steps to install scikit-learn, got into problem at step 1, here are the message:

brew install gfortran
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gfortran-4.8.1.mountain_lion.bottle.tar.gz

curl: (56) Recv failure: Connection reset by peer
Warning: Bottle installation failed: building from source.
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.8.1/gcc-4.8.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gfortran-4.8.1.tar.bz2
==> ../configure --prefix=/usr/local/Cellar/gfortran/4.8.1/gfortran --datarootdir=/usr/local/Cellar/gfortran/4.8.1/share --bindir=/usr/local/Cellar/gfortran/4.8.1/bin --enable-languages=fortran --with-system-
==> make bootstrap

then nothing happened after near 1 hour, not sure if my computer was still in executing the command.

Any suggestions? Thanks

Tian

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