I am having trouble installing the Python package rpy2. I have already compiled R as a shared library, but I do not have admin priviledges so I am trying to install rpy2 with:
pip install -user rpy2
However, I am getting the following error:
./rpy/rinterface/_rinterface.c:86:31: fatal error:
readline/readline.h: No such file or directorycompilation terminated.
error: command ‘gcc’ failed with exit status 1
I have downloaded readline to:
/some/path/readline-6.2/
where I can see readline.h (I have also compiled readline just in case)
My question:
How can I make rpy2 (or pip) aware of this location with readline.h to avoid the header compilation error?
You’ll need to actually install readline, not just download it, and then point
rpy2to it withCFLAGSandLDFLAGS.Try this approach. It’s almost working for me – I have the same problem, except an additional wrinkle that rpy2 seems to be linking against the system R instead of my homedir install.
First, I downloaded readline to
~/src/readline-6.2, and installed it with./configure --prefix=$HOME && make && make install. (You need to install it somewhere, not just download the source.)Then I re-compiled R with
R is definitely now using that readline:
The same for my in-home install of Python (3.2.3, since h5py doesn’t work with 3.3 yet):
And again:
Then I downloaded the rpy2 source and built that:
This seemed successful, and
ldding the.sos insite-packages/rpy2links to the rightlibreadline…but to the systemR, instead of mine, despite the explicit--r-home.