rpy2 install problems on debian

2020-04-21 06:51发布

I have tried every install method I can think of to install RPy2 on our debian server and I get the same message regardless. I have installed and used it successfully on my mac. Is there something I may be missing?

start

Processing rpy2
Running setup.py -q bdist_egg --dist-dir /opt/rpy2/egg-dist-tmp-oft2ko

returned an empty string.


returned an empty string.

Configuration for R as a library:
  include_dirs: ('/usr/share/R/include',)
  libraries: ('R',)
  library_dirs: ('/usr/lib64/R/lib',)
  extra_link_args: ()
 # OSX-specific (included in extra_link_args)
  framework_dirs: ()
  frameworks: ()
warning: no previously-included files matching '*patch*' found anywhere in distribution
warning: no previously-included files matching '*diff*' found anywhere in distribution
warning: no previously-included files matching '.hg' found anywhere in distribution
warning: no files found matching 'MANIFEST

'

. . .

end

./rpy/rinterface/_rinterface.c:3622: error: ‘embeddedR_isInitialized’ undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:3622: error: ‘Py_False’ undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:3634: error: ‘Py_None’ undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:3635: error: ‘PySexpObject’ has no member named ‘sObj’
./rpy/rinterface/_rinterface.c:3637: error: expected expression before ‘)’ token
./rpy/rinterface/_rinterface.c:3650: error: ‘PySexpObject’ has no member named ‘sObj’
./rpy/rinterface/_rinterface.c:3652: error: expected expression before ‘)’ token
./rpy/rinterface/_rinterface.c:3665: error: ‘PySexpObject’ has no member named ‘sObj’
./rpy/rinterface/_rinterface.c:3667: error: expected expression before ‘)’ token
./rpy/rinterface/_rinterface.c:3680: error: expected expression before ‘)’ token
./rpy/rinterface/_rinterface.c:3694: error: expected expression before ‘)’ token
./rpy/rinterface/_rinterface.c:3705: error: ‘rinterface_unserialize’ undeclared (first use in this function)
./rpy/rinterface/_rinterface.c:3705: warning: implicit declaration of function ‘PyDict_GetItemString’
error: Setup script exited with error: command 'gcc' failed with exit status 1

Thank you for the help

3条回答
我想做一个坏孩纸
2楼-- · 2020-04-21 07:22

Please try

sudo apt-get install python-rpy2

(or use whichever packaging frontend you prefer) as the package exists within the distribution.

查看更多
Rolldiameter
3楼-- · 2020-04-21 07:23

As pointed in rpy2 installation on Ubuntu, sometimes a missing python-dev (python-devel in RHEL) may cause these issues. You can fix by either

    sudo apt-get install python-dev

or

    sudo yum install python-devel

Or other OS specific instruction for installing python-dev[el]

查看更多
4楼-- · 2020-04-21 07:39

If you compile R with

./configure --enable-R-shlib, then R is installed in /usr/local/lib/R

So you can add this lines to .bashrc, for you and root user

export R_HOME=/usr/local/lib/R
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$R_HOME/lib

Then you can install from pip or build from tarball

查看更多
登录 后发表回答