Rsruby install trouble

Hello, trying for no particular reason to create a K constant calculator
for chemical equilibrium for a chemical reaction. The way the experiment
was done, I need to put a best fit line on some data. R, and therefore,
RSRuby, seems like the best to do this (if I'm wrong, please enlighten),
but I cannot get RSRuby working. I'm using R 2.8.1 (I found something
which said R 2.9.x doesn't work well with rsruby, not sure on the
validity of that, but, whatever), Mac OS X 10.4.11, and what happens is
the following.

I unpack the R package, and it goes into /Library/Frameworks/

I downloaded the rsruby distro, and try to run setup as ruby setup.rb
config -- -with-R-dir=$R_HOME (regardless of whether I set R_HOME to the
right directory (the installer thing says the right one is
/Library/Frameworks/r.something/Resources) or whether I put that in for
dir= it fails) and I get an error message, as it says it cannot find the
R directory. The README gives three solutions. The first, to put
something in the .bashrc file in ~ doesn't work as I don't have a
.bashrc file (must say OSX isn't my forte, don't know if that is in an
earlier/later OSX distro). The second is to link a file in the
/Library/Frameworks/etcetera... to /usr/lib/, which when done, does
nothing. The last also deals with a file that I don't see anywhere.

Point is, anyone know a) what I'm doing wrong or (preferably) b) an
easier way to do this?

P.S. Here is the output

/rsruby-0.5 root# ruby setup.rb config -- --with-R-dir=$R_HOME
---> lib
---> lib/rsruby
<--- lib/rsruby
<--- lib
---> ext
/usr/bin/ruby /rsruby-0.5/ext/extconf.rb
--with-R-dir=/Library/Frameworks/R.framework/Resources/
checking for main() in -lR... no

ERROR: Cannot find the R library, aborting.
setup.rb:655:in `command': system("/usr/bin/ruby"
"/rsruby-0.5/ext/extconf.rb"
"--with-R-dir=/Library/Frameworks/R.framework/Resources/") failed
(RuntimeError)
        from setup.rb:660:in `ruby'
        from setup.rb:1238:in `extconf'
        from setup.rb:1230:in `config_dir_ext'
        from setup.rb:1532:in `__send__'
        from setup.rb:1532:in `traverse'
        from setup.rb:1530:in `dive_into'
        from setup.rb:1530:in `traverse'
        from setup.rb:1524:in `exec_task_traverse'
        from setup.rb:1519:in `each'
        from setup.rb:1519:in `exec_task_traverse'
        from setup.rb:1223:in `exec_config'
        from setup.rb:991:in `exec_config'
        from setup.rb:826:in `__send__'
        from setup.rb:826:in `invoke'
        from setup.rb:773:in `invoke'
        from setup.rb:1578

···

--
Posted via http://www.ruby-forum.com/.

Hello, trying for no particular reason to create a K constant calculator
for chemical equilibrium for a chemical reaction. The way the experiment
was done, I need to put a best fit line on some data. R, and therefore,
RSRuby, seems like the best to do this (if I'm wrong, please enlighten),
but I cannot get RSRuby working. I'm using R 2.8.1 (I found something
which said R 2.9.x doesn't work well with rsruby, not sure on the
validity of that, but, whatever), Mac OS X 10.4.11, and what happens is
the following.

I unpack the R package, and it goes into /Library/Frameworks/

[snip]

Point is, anyone know a) what I'm doing wrong or (preferably) b) an
easier way to do this?

Try the gem. This works for me with ruby 1.8.7, R 2.10.1 on OSX 10.6.4.

gem install rsruby --

--with-R-dir=/Library/Frameworks/R.framework/Resources/
Building native extensions. This could take a while...
Successfully installed rsruby-0.5.1.1
1 gem installed
Installing ri documentation for rsruby-0.5.1.1...
Installing RDoc documentation for rsruby-0.5.1.1...

···

On Thu, 28 Oct 2010 07:40:14 +0900, Guybrush Threepwood <deadpool93@comcast.net> wrote:

--
Alex Gutteridge

Okay, now I'm trying to install rubygems, but am getting a weird error
message for that. Do I have to pass it anything, or should it just be
ruby setup.rb in the directory where the files are?

(the error)

./lib/rubygems.rb:723:in `set_paths': uninitialized constant Gem::Etc
(NameError)
        from ./lib/rubygems.rb:719:in `each'
        from ./lib/rubygems.rb:719:in `set_paths'
        from ./lib/rubygems.rb:526:in `path'
        from ./lib/rubygems/source_index.rb:66:in
`installed_spec_directories'
        from ./lib/rubygems/source_index.rb:56:in `from_installed_gems'
        from ./lib/rubygems.rb:736:in `source_index'
        from ./lib/rubygems/gem_path_searcher.rb:86:in `init_gemspecs'
        from ./lib/rubygems/gem_path_searcher.rb:21:in `initialize'
        from ./lib/rubygems.rb:684:in `new'
        from ./lib/rubygems.rb:684:in `searcher'
        from ./lib/rubygems.rb:683:in `synchronize'
        from ./lib/rubygems.rb:683:in `searcher'
        from ./lib/rubygems/custom_require.rb:34:in `require'
        from /usr/lib/ruby/1.8/tmpdir.rb:12
        from ./lib/rubygems/custom_require.rb:31:in
`gem_original_require'
        from ./lib/rubygems/custom_require.rb:31:in `require'
        from setup.rb:95

···

--
Posted via http://www.ruby-forum.com/.

Now I've gotten all this stuff working. The problem with getting the
right ruby and rubygems was I had an older version of xcode, but I got
the right one. So through macports I got ruby and rubygems, and through
rubygems I did the sudo install gem rsruby --
--with-R-dir=/Library/Frameworks/etcetera, and it installs correctly.
Problem is, when I type require 'rsruby' into irb (or put it into a
program), it doesn't know what it is. Do I have to hand it a path to
somewhere?

···

--
Posted via http://www.ruby-forum.com/.

That did it, thanks a lot.

···

--
Posted via http://www.ruby-forum.com/.

Sorry, actually, I'm having one more issue. When I get to the section of
the program that calls R, it says "Fatal Error: R home directory is not
defined." I thought I saw something to the effect that I stick a line of
code in some file, but I do not remember what. Do you know what that is?

···

--
Posted via http://www.ruby-forum.com/.

As per the README, I stuck the line

"export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Library/Frameworks/R.framework/Resources/bin"

into my .bashrc file, but no such luck. As for the other two options, I
cannot find the ldconfig file is says to run after doing what it says.
As noted, I'm a total newbie when it comes to this stuff, so I'm
probably just making a dumb mistake somewhere.

···

--
Posted via http://www.ruby-forum.com/.

Deadpool:~ Sam$ export
R_HOME="/Library/Frameworks/R.framework/Resources/"
Deadpool:~ Sam$ $R_HOME
-bash: /Library/Frameworks/R.framework/Resources/: is a directory
Deadpool:~ Sam$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'rsruby'
=> true
irb(main):003:0> RSRuby.instance
=> #<RSRuby:0x48c9e8 @caching=true, @cache={"get"=>#<RObj:0x48c948>,
"helpfun"=>#<RObj:0x48c060>, "help"=>#<RObj:0x48c060>, "NaN"=>NaN,
"FALSE"=>false, "TRUE"=>true, "F"=>false, "NA"=>-2147483648,
"eval"=>#<RObj:0x48c614>, "T"=>true, "parse"=>#<RObj:0x48c6f0>},
@proc_table={}, @class_table={}, @default_mode=-1>

···

--
Posted via http://www.ruby-forum.com/.

Never mind, I got it. Thanks again for all the help.

···

--
Posted via http://www.ruby-forum.com/.

If you're on OSX you should already have rubygems (I think?). Your error
looks like it comes from having a <1.8.3 version of Ruby installed:

http://rubyforge.org/tracker/index.php?func=detail&aid=22313&group_id=126&atid=575

···

On Fri, 29 Oct 2010 05:45:25 +0900, Guybrush Threepwood <deadpool93@comcast.net> wrote:

Okay, now I'm trying to install rubygems, but am getting a weird error
message for that. Do I have to pass it anything, or should it just be
ruby setup.rb in the directory where the files are?

(the error)

./lib/rubygems.rb:723:in `set_paths': uninitialized constant Gem::Etc
(NameError)
        from ./lib/rubygems.rb:719:in `each'
        from ./lib/rubygems.rb:719:in `set_paths'
        from ./lib/rubygems.rb:526:in `path'
        from ./lib/rubygems/source_index.rb:66:in
`installed_spec_directories'
        from ./lib/rubygems/source_index.rb:56:in `from_installed_gems'
        from ./lib/rubygems.rb:736:in `source_index'
        from ./lib/rubygems/gem_path_searcher.rb:86:in `init_gemspecs'
        from ./lib/rubygems/gem_path_searcher.rb:21:in `initialize'
        from ./lib/rubygems.rb:684:in `new'
        from ./lib/rubygems.rb:684:in `searcher'
        from ./lib/rubygems.rb:683:in `synchronize'
        from ./lib/rubygems.rb:683:in `searcher'
        from ./lib/rubygems/custom_require.rb:34:in `require'
        from /usr/lib/ruby/1.8/tmpdir.rb:12
        from ./lib/rubygems/custom_require.rb:31:in
`gem_original_require'
        from ./lib/rubygems/custom_require.rb:31:in `require'
        from setup.rb:95

--
Alex Gutteridge

Now I've gotten all this stuff working. The problem with getting the
right ruby and rubygems was I had an older version of xcode, but I got
the right one. So through macports I got ruby and rubygems, and through
rubygems I did the sudo install gem rsruby --
--with-R-dir=/Library/Frameworks/etcetera, and it installs correctly.
Problem is, when I type require 'rsruby' into irb (or put it into a
program), it doesn't know what it is. Do I have to hand it a path to
somewhere?

Have you required rubygems first (you will need to on older version of
ruby)? E.g.

require 'rubygems'

=> true

require 'rsruby'

=> true

···

On Fri, 29 Oct 2010 19:55:18 +0900, Guybrush Threepwood <deadpool93@comcast.net> wrote:

--
Alex Gutteridge

IIRC, the readme will help with this and other issues that come up.

···

On Oct 31, 2010, at 16:18 , Guybrush Threepwood wrote:

Sorry, actually, I'm having one more issue. When I get to the section of
the program that calls R, it says "Fatal Error: R home directory is not
defined." I thought I saw something to the effect that I stick a line of
code in some file, but I do not remember what. Do you know what that is?

Assuming you are using Bash as your shell (I think it is the default in
OSX), to define R_HOME put

export R_HOME="/Library/Frameworks/R.Framework/Resources"

Into ~/.bashrc and source it / restart the terminal session. If you're
using a different shell then Google for how to set environment variables.

···

On Mon, 1 Nov 2010 08:18:35 +0900, Guybrush Threepwood <deadpool93@comcast.net> wrote:

Sorry, actually, I'm having one more issue. When I get to the section of

the program that calls R, it says "Fatal Error: R home directory is not
defined." I thought I saw something to the effect that I stick a line of

code in some file, but I do not remember what. Do you know what that is?

--
Alex Gutteridge

Alex Gutteridge wrote in post #958443:

Assuming you are using Bash as your shell (I think it is the default in
OSX), to define R_HOME put

export R_HOME="/Library/Frameworks/R.Framework/Resources"

Into ~/.bashrc and source it / restart the terminal session. If you're
using a different shell then Google for how to set environment
variables.

Unfortunately, that didn't work either, as it still spits out the same
error. I tried it with and without the quotes, but in both cases it just
doesn't see it. Any other possibilities?

···

--
Posted via http://www.ruby-forum.com/\.

Alex Gutteridge wrote in post #958443:

Assuming you are using Bash as your shell (I think it is the default in
OSX), to define R_HOME put

export R_HOME="/Library/Frameworks/R.Framework/Resources"

Into ~/.bashrc and source it / restart the terminal session. If you're
using a different shell then Google for how to set environment
variables.

Unfortunately, that didn't work either, as it still spits out the same
error. I tried it with and without the quotes, but in both cases it just

doesn't see it. Any other possibilities?

Type the following and show me your terminal output.

export R_HOME="/Library/Frameworks/R.framework/Resources/"
$R_HOME
irb
require 'rsruby'
RSRuby.instance

This is what I get:

GUTTEA$ export R_HOME="/Library/Frameworks/R.framework/Resources/"
GUTTEA$ $R_HOME
-bash: /Library/Frameworks/R.framework/Resources/: is a directory
GUTTEA$ irb

require 'rsruby'

=> true

RSRuby.instance

=> #<RSRuby:0x101176ce8 @class_table={}, @default_mode=-1, @caching=true,
@cache={"get"=>#<RObj:0x101176810>, "helpfun"=>#<RObj:0x101172f80>,
"help"=>#<RObj:0x101172f80>, "NaN"=>NaN, "FALSE"=>false, "TRUE"=>true,
"F"=>false, "NA"=>-2147483648, "eval"=>#<RObj:0x1011752a8>, "T"=>true,
"parse"=>#<RObj:0x101175820>}, @proc_table={}>

···

On Tue, 2 Nov 2010 00:40:19 +0900, Guybrush Threepwood <deadpool93@comcast.net> wrote:

--
Alex Gutteridge