没有管理员权限安装rpy2 [英] Installing rpy2 without admin privileges
问题描述
我无法安装Python软件包 rpy2 。我已经将R编译为共享库,但我没有管理员权限,所以我试图安装rpy2:
pip install -user rpy2
但是,我收到以下错误:
./ rpy / rinterface / _rinterface.c:86:31:致命错误:
readline / readline.h:没有这样的文件或目录
编译终止。
错误:命令'gcc'失败,退出状态1
我已经将 readline
下载到:
/some/path/readline-6.2/
我可以看到 readline.h
(我也编译了 readline
以防万一)
我的问题:
如何使 rpy2
(或pip)知道 readline.h
避免标题编译错误?
您需要实际安装readline,而不只是下载它,然后用 CFLAGS 来指向
rpy2
code>和 LDFLAGS
。
试试这种方法。它几乎为我工作 - 我有同样的问题,除了一个额外的皱纹,rpy2似乎与系统R,而不是我的homedir安装链接。
首先,我将下载的readline下载到〜/ src / readline-6.2
,并使用 ./configure --prefix = $ HOME&&&制作&& make install
。 (您需要将它安装在某处,而不只是下载源代码。)然后我用R
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现在正在使用readline:
$ ldd〜/ lib64 / R / lib / libR.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6(0x00007f8104207000)
家庭安装Python(3.2.3,因为h5py不能与3.3一起工作):
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
还有:
$ ldd〜/ lib / python3.2 / lib-dynload / readline.cpython -32m.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6(0x00007fbfff5c2000)
然后我下载了rpy2源代码并建立了:
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
这看起来很成功, ldd
site-packages / rpy2
中的 .so
链接到右侧 libreadline
...但系统 R
,而不是我的,尽管明确的 - r-家庭
。
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 directory
compilation 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 rpy2
to it with CFLAGS
and LDFLAGS
.
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
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 is definitely now using that readline:
$ ldd ~/lib64/R/lib/libR.so | grep readline
libreadline.so.6 => /home/dsutherl/lib/libreadline.so.6 (0x00007f8104207000)
The same for my in-home install of Python (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 that:
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 successful, and ldd
ing the .so
s in site-packages/rpy2
links to the right libreadline
...but to the system R
, instead of mine, despite the explicit --r-home
.
这篇关于没有管理员权限安装rpy2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!