Debugging failed Ruby Gem require

Hi there,

I’m trying to debug why my Ruby installation cannot find gems even
though we’ve followed what I think is a standard install.

In this case I’m trying to use micro-optparse and the require fails as
follows:

internal:lib/rubygems/custom_require:29:in require': no such file to load -- micro-optparse (LoadError) from <internal:lib/rubygems/custom_require>:29:inrequire’
from /home/sjalloq/bin/checkout:3:in `’

The gem was installed using ‘gem install …’ and I can list the gem:

$ gem list mic

*** LOCAL GEMS ***

micro-optparse (1.1.5)

If I set RUBYLIB to point to the gem installation then it loads but I
thought RUBYLIB was only needed for non-standard installs.

Is my understanding of installing gems correct and if so how do I debug
this further?

$ gem --version
1.3.7

$ ruby --version
ruby 1.9.2p136 (2010-12-25) [x86_64-linux]

Thanks, Shareef.

On Fri, Aug 17, 2012 at 6:34 AM, Shareef J. [email protected]
wrote:

    from <internal:lib/rubygems/custom_require>:29:in `require'

$ ruby --version
ruby 1.9.2p136 (2010-12-25) [x86_64-linux]

Thanks, Shareef.


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

It’s a little hard to say, but:

  1. That’s a damn old version of rubygems. Try executing gem update to
    update to the latest sources and whatnot.
  2. If gem can find a package, and ruby cannot find a package, then gem
    is
    probably not using the version of ruby you think it is.
  3. Check the paths that gem is searching through (gem env) and the paths
    that ruby is searching through (ruby -e “puts $:”) and see what’s
    different.

On 08/17/2012 05:34 AM, Shareef J. wrote:

     from<internal:lib/rubygems/custom_require>:29:in `require'

$ ruby --version
ruby 1.9.2p136 (2010-12-25) [x86_64-linux]

Thanks, Shareef.

Do you have more than one ruby installation? I’ve got three (the system
1.9, the system 1.8, and my custom 1.9 install which is more recent).
Each install has it’s own copy of the gem program, and if I install a
gem with one in one version, the other versions have no idea that it’s
there.

Try:
which gem (using the exact same form that you used for the gem install)
and also:
which ruby (again, using the same form that you used to attempt
execution)

One of my installs is in /usr/local/bin/gem and /usr/local/bin/ruby,
another is in /usr/bin/gem1.9.1 and /usr/bin/ruby1.9.1,
the third is /usr/bin/ruby1.8 (gem isn’t installed for that one),

Hi both,

thanks for the replies. Updating the gem version and re-installing has
fixed the issue.

Many thanks.