Wednesday, September 28, 2005
rpy
But, getting all that set up is non-trivial. Especially if you're doing this all on a Macintosh. The Macintosh is almost Unix but with enough differences to throw the User a few curves from time to time. One of the differences is that the Mac prefers to have programs built as 'frameworks' (don't ask, just accept it). There is a howto on building R on the Mac that gives the direction for doing just that. The main take-home from the howto is the options for configure:
The rest is vanilla make and sudo make install. But to build rpy you need to build R as a shared library. This means, according to the rpy README, that you should add --enable-R-shlib to the R ./configure line../configure --with-blas='-framework vecLib' --with-lapack --with-aqua
Building rpy is pretty easy:
But if you do that you pretty quickly fail withRHOMES=/Library/Frameworks/R.framework/Resources
export RHOMES
python setup.py build
sudo python setup.py install
If you look in /Library/Frameworks/R.framework/Resources/modules you will find lapack.so which seems like it should do the trick. You can modify the setup.py to look at that lapack.so, but it just won't work. You can then tear your hair out for a while. At some point before you go bald you should note that the setup.py is looking for Rlapack not lapack. At this point you're desperate so you delete the entire R build and start over with this configure line:ld: can't locate file for: -lRlapack
error: command 'gcc' failed with exit status 1
Looking in /Library/Frameworks/R.framework/Resources/lib will show you Rlapack.dylib! Try the rpy build over again and now you succeed! Wahoo!./configure --with-blas='-framework vecLib' --with-aqua --enable-R-shlib
I'm having a bit of trouble generating graphics, but the basic R functionality seems to be visible from Python. Life is full.