ruby gems private method specification_version problem

/usr/lib/ruby/1.8/rubygems/source_index.rb:86:in `load_specification': private method `specification_version=' called for # (NoMethodError)
        from /usr/lib/ruby/1.8/rubygems/specification.rb:401:in `initialize'
        from (eval):1:in `new'
        from (eval):1:in `load_specification'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:121:in `eval'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:86:in `load_specification'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:121:in `load_gems_in'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:120:in `each'
        from /usr/lib/ruby/1.8/rubygems/source_index.rb:120:in `load_gems_in'
         ... 8 levels...

Try

ruby -v

because you probably have 1.8.x. If so, install ruby 1.9 and execute the code with it.

Unfortunately in ubuntu there seems to be a problem with the packages dependency. If you install rubygems package you get ruby1.8 also. The solution is to run the code explicitly with “ruby1.9” instead of “ruby” or for your own responsibility:

rm /usr/bin/ruby
ln -s /usr/bin/ruby1.9 /usr/bin/ruby

You may then get a:

/usr/bin/gem:9:in `require': no such file to load -- rubygems (LoadError)
        from /usr/bin/gem:9

This is because ruby1.8 had the gems installed, not 1.9. You can check that through:

locate rubygems.rb

The solution is to install gems for ruby1.9 as well. But there is another problem, The ruby1.9 has no complete rake installed.

So the best thing to do in my opinion is not waste time and do something like:

apt-get remove ruby ruby1.9 ruby1.8 rubygems rake
cd /opt/install
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-5.tar.bz2
tar -xf ruby-1.9.0-5.tar.bz2
cd ruby-1.9.0-5
./configure --prefix="/opt/ruby1.9"
make
make install

And then setup your $PATH, edit .bashrc or whatever (.profile, …) and place the parth to /opt/ruby1.9/bin dir in it.

export GEM_HOME=$HOME/opt/gems
export GEM_PATH=$HOME/opt/gems/gems
export PATH=$PATH:/opt/ruby1.9/bin

This worked for me.

You can also have a look at: /2009/06/08/ruby-1-8-6-in-ubuntu-9-04-64-minimal

Posted by wojtek Tue, 11 Nov 2008 13:11:00 GMT




Comments

Leave a response

  1. Rashid 26 days later:

    Rails sucks.

Leave a comment