Installing rpy2 without admin rights

I am having trouble installing the Python rpy2 package . I have already compiled R as a shared library, but I do not have admin privileges, 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 directory

compilation completed.

Error: command 'gcc' failed with exit status 1

I uploaded readline

to:

/some/path/readline-6.2/

      

where i see readline.h

(i also compiled readline

just in case)

My question is:

How can I make rpy2

(or pip) this location information using readline.h

to avoid header compilation error?

+3


source to share


4 answers


You will need to actually install readline, not just download it and then point rpy2

to it with CFLAGS

and LDFLAGS

.

Try this approach. This almost works for me - I have the same problem, apart from the extra wrinkle, that rpy2 seems to connect to the R system instead of my homedir installation.

I first downloaded readline in ~/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 recompiled R with

CPPFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
./configure --prefix=$HOME --enable-BLAS-shlib --enable-R-shlib
make
make install

      

R certainly uses this readline now:

$ ldd ~/lib64/R/lib/libR.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6 (0x00007f8104207000)

      



Same for my home Python installation (3.2.3, since h5py doesn't work with 3.3 yet):

CFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
./configure --prefix=$HOME
make
make install

      

And again:

$ ldd ~/lib/python3.2/lib-dynload/readline.cpython-32m.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6 (0x00007fbfff5c2000)

      

Then I downloaded the rpy2 source and built it:

CFLAGS="-I/usr/local/include -I$HOME/include/" \
LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L$HOME/lib64 -L$HOME/lib" \
python3 setup.py build --r-home $HOME/lib64/R install

      

This seemed to be successful, and ldd

link .so

in the site-packages/rpy2

links on the right libreadline

... but with the system R

instead of mine, despite being explicit --r-home

.

+2


source


more simple:

yum install readline-devel.x86_64

      

run for me on centos 7



for debian / ubuntu

apt-get install libreadline-dev

      

0


source


Sometime in Linux a sudo apt-get update is required to get news libraries can work

-2


source


This is another option, but you also need root privileges ... sudo apt-get install libreadline-dev

-2


source







All Articles