R built from source, installed locally. R is at ~/bin/R (which is in my PATH) and its libraries are in ~/lib64/R/. Installing rpy2 should be simple. It finds the correct R just fine (as it's in the path). Then it can't find the libraries.
$python setup.py build install
R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
...
setup.py:211: UserWarning: No include specified
  warnings.warn('No include specified')
setup.py:222: UserWarning: No libraries as -l arguments to the compiler.
  warnings.warn('No libraries as -l arguments to the compiler.')
    Compilation parameters for rpy2's C components:
        include_dirs    = []
        library_dirs    = []
        libraries       = []
        extra_link_args = []
And then we get a million errors that it can't find functions that are in the R libraries.
Rpy2's documentation says there's a simple option for designating where R or its libraries are:
python setup.py build --r-home ~/lib64/R/lib install
But if you do this, then you get:
setup.py:222: UserWarning: No libraries as -l arguments to the compiler.
  warnings.warn('No libraries as -l arguments to the compiler.')
    Compilation parameters for rpy2's C components:
        include_dirs    = []
        library_dirs    = []
        libraries       = []
        extra_link_args = []
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help
error: option --r-home not recognized
It looks like the --r-home functionality has been removed. How does one point rpy2 to the correct libraries?
Edit:
Have now installed R with:
./configure --prefix=${HOME} --enable-R-shlib
make
make install
After that, I can install rpy2 with just pip install rpy2. But then, we're still having library problems:
import rpy2.robjects as robjects
ImportError: libRblas.so: cannot open shared object file: No such file or directory
So then I needed to add this to my path:
export LD_LIBRARY_PATH="~/lib64/R/lib:$LD_LIBRARY_PATH"
And then everything works!
 
     
     
     
    