Forum: Ruby Using gems problem -- LoadError

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Vladsialv T. (Guest)
on 2006-04-12 19:02
(Received via mailing list)
Hello all,
I am a newbie with ruby and gems and I have this frustrating problem not
being
able to load any gem I install. I am running Ubuntu 5.10 and I have just
installed ruby1.8 deb (1.8.4) and have compiled rubygems-0.8.11 without
any
problem. I am able to load rubygems (require 'rubygems') and I setup
RUBYOPT
var as advised in gems doc (export RUBYOPT=rubygems). However, when I
try to
load a gem ($ruby1.8 -e "require 'some_gem' ") I always get an error
(This is
for xml-simple gem:

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__': no
such file to load -- xml-simple (LoadError)
        from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
        from -e:1

I checked and it seems that rubygems creates a dir-y for every installed
gem
in /usr/lib/ruby/gems/1.8/gems/, but this dir-y is not in the load path:
$ ruby1.8 -e "p $:"
["/usr/local/lib/site_ruby/1.8",
"/usr/local/lib/site_ruby/1.8/i486-linux",
"/usr/local/lib/site_ruby/1.8/i386-linux", "/usr/local/lib/site_ruby",
"/usr/lib/ruby/1.8", "/usr/lib/ruby/1.8/i486-linux",
"/usr/lib/ruby/1.8/i386-linux", "."]

... in the other hand rubygems has been installed
in /usr/local/lib/site_ruby/1.8/

$ ls -l /usr/local/lib/site_ruby/1.8
gemconfigure.rb
i486-linux
rubygems
rubygems.rb
ubygems.rb

So at this point I am confused ... Could someone help me understand what
I am
missing here or point me to a doc or howto

Cheers
Vlad
Austin Z. (Guest)
on 2006-04-12 19:09
(Received via mailing list)
On 4/12/06, Vladsialv T. <removed_email_address@domain.invalid> wrote:
> Hello all,
> I am a newbie with ruby and gems and I have this frustrating problem not being
> able to load any gem I install. I am running Ubuntu 5.10 and I have just
> installed ruby1.8 deb (1.8.4) and have compiled rubygems-0.8.11 without any
> problem. I am able to load rubygems (require 'rubygems') and I setup RUBYOPT
> var as advised in gems doc (export RUBYOPT=rubygems). However, when I try to
> load a gem ($ruby1.8 -e "require 'some_gem' ") I always get an error (This is
> for xml-simple gem:

Try "require 'xml/simple'". One has to require the libraries that are
represented in the gem, not the gem itself.

With some gems, you can autorequire the code by requiring_gem-ing the
gem, but this functionality may ultimately go away and it is dependent
on each gem.

The xml-simple gem documentation should indicate what you must include.

-austin
Vladsialv T. (Guest)
on 2006-04-12 20:59
(Received via mailing list)
Thank you Austin .. that was it.. I was using wrong libraries names

Cheers
Vlad
This topic is locked and can not be replied to.