Created
September 11, 2012 18:50
-
-
Save acompa/3700827 to your computer and use it in GitHub Desktop.
Installing rpy2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 == version of R to install | |
##### | |
# Install R | |
##### | |
wget http://cran.r-project.org/src/base/R-2/R-$1.tar.gz | |
tar zxvf R-$1.tar.gz | |
cd R-$1/ | |
./configure --enable-R-shlib --with-x=no # mandatory for rpy2, install with X if not an EC2 instance | |
make | |
make check | |
sudo make install | |
cd .. | |
sudo rm -rf R-$1/ build/ | |
rm R-$1.tar.gz | |
##### | |
# rpy2 on Ubuntu is easy--just make sure Python can find the shared libs | |
##### | |
sudo pip install rpy2 | |
export PATH=$PATH:/usr/local/lib | |
##### | |
# rpy2 for Mac is...different. | |
##### | |
#wget http://pypi.python.org/packages/source/r/rpy2/rpy2-2.2.6.tar.gz | |
#tar zxvf rpy2-2.2.6.tar.gz | |
#cd rpy2-2.2.6/ | |
#python setup.py build --r-home /usr/local/bin/R --r-home-lib /usr/local/bin/R/lib#sudo python setup.py install | |
#cd .. | |
#rm -rf rpy2-2.2.6/ | |
## Linking libraries to /usr/local/lib. | |
sudo ln -s /usr/local/lib/R/lib/libR.so /usr/local/lib/ | |
sudo ln -s /usr/local/lib/R/lib/libRlapack.so /usr/local/lib/ | |
sudo ln -s /usr/local/lib/R/lib/libRblas.so /usr/local/lib/ | |
sudo ldconfig | |
## Confirm successful installation. | |
python -m 'rpy2.tests' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment