Opened 11 years ago

Closed 11 years ago

#11886 closed defect (fixed)

fix scipy so it builds on OS X Lion

Reported by: jhpalmieri Owned by: tbd
Priority: major Milestone: sage-4.8
Component: packages: standard Keywords: scipy spkg upgrade update lion darwin 11
Cc: leif, mhansen Merged in: sage-4.8.alpha1
Authors: John Palmieri Reviewers: Mike Hansen, Leif Leonhardy
Report Upstream: Fixed upstream, but not in a stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by leif)

As the summary says. The new spkg applies the patches from this commit to the scipy github repo.  New spkg at

The home base for this ticket is the Lion ticket #11881.

Attachments (2)

trac_11886-scipy.patch (2.5 KB) - added by jhpalmieri 11 years ago.
patch for scipy pkg, for review only
scipy-0.9.p0-p1.diff (3.8 KB) - added by leif 11 years ago.
Diff between John's p0 and my p1. For reference / review.

Download all attachments as: .zip

Change History (14)

Changed 11 years ago by jhpalmieri

patch for scipy pkg, for review only

comment:1 Changed 11 years ago by jhpalmieri

  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 11 years ago by leif

They should really fix the hundreds of warnings...

Builds on Solaris (SPARC), with GCC 4.5.1 (on mark2) at least.

comment:3 Changed 11 years ago by kcrisman

  • Description modified (diff)

comment:4 Changed 11 years ago by mhansen

  • Reviewers set to Mike Hansen
  • Status changed from needs_review to positive_review

These were the changes I had to make before. Builds on Lion for me.

comment:5 Changed 11 years ago by leif

  • Report Upstream changed from N/A to Fixed upstream, but not in a stable release.
  • Reviewers changed from Mike Hansen to Mike Hansen, Leif Leonhardy
  • Status changed from positive_review to needs_work

Minor thing (another copy-paste accident):

The changelog entries should have === (instead of ==):

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    2626 * Python, which in Sage has numerous dependencies
    2727 * Numpy
    2828 * Fortran
     29 * GNU patch
    2930
    3031== Special Update/Build Instructions ==
    31  * None
     32 * Make sure the patches still apply.
     33   The ones added in the scipy-0.9.p0 spkg (#11886) were all taken from
     34   (unstable) upstream, so can presumably be removed once we upgrade to
     35   a new stable version.
    3236
    3337== Changelog ==
    3438
    35 == scipy-0.9.p0 (John Palmieri, 30 Sept 2011) ==
     39=== scipy-0.9.p0 (John Palmieri, 30 Sept 2011) ===
    3640 * #11886: get scipy to build on OS X 10.7 Lion, using the patches from
    3741   https://github.com/scipy/scipy/commit/effa6f68f8ada57b79864852b609ff06d2527306
    3842
    39 == scipy-0.9 (F. Bissey; 16 March 2011) ===
     43=== scipy-0.9 (F. Bissey; 16 March 2011) ===
    4044 * updated the source to 0.9.0. No patches needed.
    4145
    42 == scipy-0.8 (S. Reiterer, F. Bissey, D. Kirkby, J. H. Palmieri; 14 October 2010) ===
     46=== scipy-0.8 (S. Reiterer, F. Bissey, D. Kirkby, J. H. Palmieri; 14 October 2010) ===
    4347 * #9808 Upgrade to scipy 0.8.
    4448 * Deleted outdated patches
    4549 * spkg install changed by F. Bissey, because g95 makes trouble on OS X.

(The merger script is btw. likely to reject the spkg otherwise.)


spkg-install isn't executable.

GNU patch should be added to the dependencies. (See diff above).

if [ $? -ne 0 ]; then
    echo "Error patching setup.py"
    exit 1
fi

should get removed, since no patch gets applied to setup.py.

There are a few typos in the comments, and spkg-install lacks the usual sanity check.

  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    2 # These flags confuse numpy's distutils.   In particular,
     2
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
     5    echo >&2 "Maybe run 'sage -sh'?"
     6    exit 1
     7fi
     8
     9# These flags confuse numpy's distutils.  In particular,
    310# if they are set empty bad things happen.
     11unset CFLAGS CXXFLAGS SHAREDFLAGS
     12echo "Note: CFLAGS, CXXFLAGS and SHAREDFLAGS are taken from distutils,"
     13echo "      so their current settings are ignored."
    414
    5 unset CFLAGS CXXFLAGS SHAREDFLAGS
    6 
    7 if [ `uname` = "Darwin" ]; then
     15if [ "$UNAME" = "Darwin" ]; then
    816    unset ATLAS
    917    unset BLAS
    1018    unset LAPACK
     
    2331export F90="$SAGE_LOCAL/bin/sage_fortran"
    2432export F95="$SAGE_LOCAL/bin/sage_fortran"
    2533
    26 
    27 # This avoid problems on some systems -- until we officially
    28 # support umfpack (which we will likely do, since cvxopt
    29 # I think includes it).
    30 #   http://projects.scipy.org/pipermail/scipy-user/2006-July/008661.html
    31 # (Currently swig gets invoked by scipy when building the umfpack interace,
     34# This avoids problems on some systems -- until we officially
     35# support umfpack (which we will likely do, since cvxopt I think includes it):
     36UMFPACK="None"; export UMFPACK
     37# See http://projects.scipy.org/pipermail/scipy-user/2006-July/008661.html
     38# (Currently SWIG gets invoked by scipy when building the umfpack interface,
    3239# which is bad.)
    3340
    34 UMFPACK="None"; export UMFPACK
     41
     42# Remove previous installation (if any):
    3543rm -rf "$SAGE_LOCAL"/lib/python/site-packages/scipy
    3644
    3745cd src/
    3846
     47# Apply patches (if any):
    3948for patch in ../patches/*.patch; do
    4049    patch -p1 <"$patch"
    4150    if [ $? -ne 0 ]; then
    42         echo >&2 "Error applying '$patch'"
     51        echo >&2 "Error applying '$patch'."
    4352        exit 1
    4453    fi
    4554done
    4655
     56# Build:
     57python setup.py build
    4758if [ $? -ne 0 ]; then
    48     echo "Error patching setup.py"
    49     exit 1
    50 fi
    51 
    52 # Build
    53 python setup.py build
    54 if [ $? -ne 0 ]; then
    55     echo "Error building scipy."
     59    echo >&2 "Error building scipy."
    5660    exit 1
    5761fi
    5862
    59 # Intall
    60 python setup.py install 
     63# Install:
     64python setup.py install
    6165if [ $? -ne 0 ]; then
    62     echo "Error installing scipy."
     66    echo >&2 "Error installing scipy."
    6367    exit 1
    6468fi
    65 

(Take whatever you like, or I could upload an updated spkg.)

I'm not sure whether we should only remove an old installation upon a successful build, after python setup.py build, but before running python setup.py install.

comment:6 Changed 11 years ago by leif

  • Description modified (diff)
  • Status changed from needs_work to needs_review

FWIW, there are so many changes, I've made a p1:

http://sage.math.washington.edu/home/leif/Sage/spkgs/scipy-0.9.p1.spkg

Changed 11 years ago by leif

Diff between John's p0 and my p1. For reference / review.

comment:7 Changed 11 years ago by jhpalmieri

  • Status changed from needs_review to positive_review

Looks good to me. The only change I might consider in addition is this:

  • SPKG.txt

    diff --git a/SPKG.txt b/SPKG.txt
    a b BSD terms. See http://www.scipy.org/Lice 
    3333   The ones added in the scipy-0.9.p0 spkg (#11886) were all taken from
    3434   (unstable) upstream, so can presumably be removed once we upgrade to
    3535   a new stable version.
     36 * To do: in spkg-install, should we only remove the previous
     37   installation after successfully building the new one?  That is, is
     38   it safe to move 'rm -rf "$SAGE_LOCAL"/lib/python/site-packages/scipy'
     39   so it is between 'python setup.py build' and 'python setup.py
     40   install'?
    3641
    3742== Changelog ==
    3843

comment:8 Changed 11 years ago by leif

I've attached a diff with my changes w.r.t. John's spkg.

comment:9 Changed 11 years ago by jdemeyer

  • Milestone changed from sage-4.7.2 to sage-4.7.3

comment:10 Changed 11 years ago by jdemeyer

  • Milestone sage-4.7.3 deleted

Milestone sage-4.7.3 deleted

comment:11 Changed 11 years ago by jhpalmieri

  • Milestone set to sage-4.8

By the way, this builds and doctests pass on a variety of platforms.

comment:12 Changed 11 years ago by jdemeyer

  • Merged in set to sage-4.8.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.