Sunday, November 14, 2010

MacPorts



I decided to try MacPorts, but ran into some problems that aren't solved yet. I thought maybe it would make it easier to install SciPy. (Yes, I know I've already got it installed). I used the MacPorts installer first and then tried working on Python first and afterwards SciPy.

MacPorts wants you to keep everything separate, so for example, I need a different Python installed by them. The first weird thing is they came up with numerous dependencies for Python, which I never heard of. One of those (db46) failed because I didn't have the very latest Java installed. So I (re) registered as a Developer, and got that from Apple:

javadeveloper_10.6_10m3261.dmg

Next:

sudo port install python27
Password:
---> Computing dependencies for python27
---> Dependencies to be installed: db46 gdbm gettext expat libiconv gperf ncurses ncursesw openssl zlib readline sqlite3 tk Xft2 fontconfig freetype pkgconfig xrender xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python26 xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-renderproto tcl xorg-libXScrnSaver xorg-libXext xorg-scrnsaverproto

Wow. Scroll that out there to see them all. It's a long list.

Two strange things: in the middle of doing Python 2.7 it downloaded and built Python 2.6! And...

--->  Fetching gcc44
---> Attempting to fetch gcc-core-4.4.5.tar.bz2 from http://mirror.facebook.net/gnu/gnu/gcc/gcc-4.4.5
---> Attempting to fetch gcc-fortran-4.4.5.tar.bz2 from http://mirror.facebook.net/gnu/gnu/gcc/gcc-4.4.5
---> Attempting to fetch gcc-g++-4.4.5.tar.bz2 from http://mirror.facebook.net/gnu/gnu/gcc/gcc-4.4.5
---> Attempting to fetch gcc-java-4.4.5.tar.bz2 from http://mirror.facebook.net/gnu/gnu/gcc/gcc-4.4.5
---> Attempting to fetch gcc-objc-4.4.5.tar.bz2 from http://mirror.facebook.net/gnu/gnu/gcc/gcc-4.4.5
---> Verifying checksum(s) for gcc44
---> Extracting gcc44
---> Configuring gcc44
---> Building gcc44
---> Staging gcc44 into destroot
---> Installing gcc44 @4.4.5_0
---> Activating gcc44 @4.4.5_0
---> Cleaning gcc44


(It took a very long time). What is harder to believe? That Facebook is a mirror for gnu, or that these guys want to install GCC 4.4.5? Well, they did. Next up: SciPy. And of course, there is no package for Python 2.7, only 2.6!

sudo port install py26-scipy @0.8.0
Password:
---> Computing dependencies for py26-scipy
---> Dependencies to be installed: atlas py26-nose py26-distribute py26-numpy fftw-3 swig-python bison m4 gsed python_select swig pcre
---> Verifying checksum(s) for atlas
Error: Checksum (md5) mismatch for lapack.tgz
Error: Checksum (sha1) mismatch for lapack.tgz
Error: Checksum (rmd160) mismatch for lapack.tgz
Error: Target org.macports.checksum returned: Unable to verify file checksums
Error: Failed to install atlas

A really stupid but quite common problem. The md5 checksum in the portfile equals the md5 checksum of the previous version of lapack(3.2.2). So I started reading the guide, and figured out how to deal with the issue. I downloaded the original software using curl to maintain it as a .tgz:

curl -O http://www.netlib.org/lapack/lapack.tgz

computed various checksums

md5 lapack.tgz 
MD5 (lapack.tgz) = 70aba8e5ecdccb6003850db178e551a2

openssl sha1 lapack.tgz
SHA1(lapack.tgz)= a0354c8eda9737319f93472068bbf187b26e1e69

openssl rmd160 lapack.tgz
RIPEMD160(lapack.tgz)= 253d0597f275fd5cd86a1a447ef56c92635aff74

Followed the instructions:
Make a copy of the Portfile you wish to modify; both files must be in the same directory, though it may be any directory.


cd $(port dir atlas)
cp Portfile ~/Desktop
cp Portfile ~/Desktop/Portfile.orig

cd ~/Desktop
diff -u Portfile.orig Portfile > Portfile-atlas.diff
cd $(port dir atlas)
sudo patch -p0 < ~/Desktop/Portfile-atlas.diff
Password:
patching file Portfile

ls -al Portfile
-rw-r--r-- 1 root wheel 11610 Nov 15 06:04 Portfile

And now MacPorts unpacks the thing, but the build fails later:

sudo port install atlas
Portfile changed since last build; discarding previous state.
---> Computing dependencies for atlas
---> Fetching atlas
---> Verifying checksum(s) for atlas
---> Extracting atlas
---> Applying patches to atlas
---> Configuring atlas
---> Building atlas
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for atlas is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_atlas/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>


I haven't solved that yet. And that seems to be a weakness of what looks like a pretty sophisticated system. How would you specify that it use a previous version of LAPACK?