Posts Tagged ‘troubleshooting’

Installing numpy 1.2.1 on Mac OS X Leopard 10.5.6

Friday, March 6th, 2009

NOTE - UPDATE: While the following will install numpy 1.2.1, it’s perhaps not the best solution. If interested just inform yourself about the Apple system python as opposed to a standalone framework python installation.

That stuff bugged me for a while, now it seems as if I found a pretty decent solution to this.

Leopard comes with python 2.5.1 preinstalled and also includes numpy 1.0.1 (if I remember well). If you want to install something that uses a newer numpy (e.g., matplotlib) then you need to upgrade numpy. There are all these issues about the differing versions/distributions of python on Apple computers, I won’t dwell on that. If you don’t want to upgrade your python distribution that there’s an easier way:

1) Set the following symbolic link: (see http://wiki.python.org/moin/MacPython/Leopard)

cd /Library/Frameworks
sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework

This allows you to use the ‘normal’ installer for numpy, see step 2.

2) Install the numpy 1.2.1 .dmg from here: Download NumPy

3) Your numpy installation ends up here:

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/

3.5) You may want to make a backup of the old numpy if there is one here:

/Library/Python/2.5/site-packages/ (just rename it, delete it, chmod 000 it, whatever)

4) Move it away from the Framework location:

cd /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/
sudo mv numpy* /Library/Python/2.5/site-packages/

5) DONE:

hostname$ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import numpy
>>> numpy.__version__
‘1.2.1′
>>>

And that’s it! The next things now will be to get matplotlib to work, the easy_install does not yet want to work, but that has nothing to do with numpy anymore! This time it’s rather freetype2…

Changing the CRAN repository of R

Thursday, February 21st, 2008

After the last upgrade R didn’t seem to want to install new packages. The likely reason is that one of the UK CRAN mirrors (http://www.sourcekeg.co.uk/cran/) is not working (at least as of 21/02/08). R fails to install packages with
Warning: unable to access index for repository http://www.sourcekeg.co.uk/cran/bin/macosx/universal/contrib/2.6

To be able to choose a different mirror, just issue options(”repos”=c(CRAN=”@CRAN@”)) on the R command line and the next time a package has to be installed from CRAN you will be asked which mirror to use. See ?setRepositories and ?options for more info.