installing RSRuby in Ubuntu 10.04

流过昼夜 提交于 2019-12-06 02:19:30
Martin Carpenter

I don't read Japanese but this worked for me on Ubuntu 10.10, ruby 1.9: http://d.hatena.ne.jp/cuspos/20090520/1242825057

# gem install rsruby-0.5.1.1.gem -- --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include 
Building native extensions.  This could take a while...
Successfully installed rsruby-0.5.1.1
1 gem installed
# export R_HOME=/usr/lib/R
# irb 
irb(main):001:0> require 'rsruby'
=> true
irb(main):002:0>

You might want to check to see if your PATH variables or dynamic links are set up so that Ruby and friends are "looking" in the right place. Ruby appears to expect RSruby to be in /var/lib/gems/1.8/gems/rsruby-0.5.1.1/ or perhaps /usr/lib/ruby/1.8/rubygems/ or perhaps /var/lib/gems/1.8/gems/rsruby-0.5.1.1/lib/, .... while your configure report says it was installed in /usr/bin/ruby1.8 /home/chris/R/. I don't have a ton of Linux experience, but what I do have tells me that each distro is different with respect to where it expects to find installed executables.

Your attempts with apt-get and gem install suggest that the installer cannot find the R header files. I would start by fixing this problem, not try other ways of installing RSruby. The next question is why it cannot find the R headers, there are two options:

  • The headers are installed, but they cannot be found. Use locate R.h to find where the R header file is located, and make sure this is in your $PATH.
  • The headers are not installed (which I suspect is the case). Often installing header files requires a development package to be installed. Try and see if there is an R-dev package or something named similarly which would contain, among others, the R header file. Installing this R-dev can be done using apt-get. The standard version of R in ubuntu 10.04 is not really up-to-date I think. CRAN has ubuntu repositories, where the dev package is called r-base-dev. Adding this repo to your sources.list gets you the latest version of R from CRAN through apt-get.

You have successfully installed rsruby, as shown by the output from your 5th example:

Successfully installed rsruby-0.5.1.1
1 gem installed

The library did not load in irb because using Ruby 1.8.7, you need to "require rubygems" first. Try this in irb:

require 'rubygems'
require 'rsruby'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!