Topic: Problem with rubygems on Ubuntu

Hi,

I was having problems on Windows (I haven't check rubygems 1.0 update on Windows yet) and decided to install Ruby and Rails on Ubuntu 7.10.

I installed everything using apt-get and it worked fine until I ran "gem update --system". Version 1.0 was fetched and now I get the following error when trying to run "gem":

/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

I tried reinstalling by "apt-get remove rubygems" and then reinstalling it again, but it didn't help.

Any ideas how to fix it?

Re: Problem with rubygems on Ubuntu

Do you want to avoid the apt-get and install it manually?

Re: Problem with rubygems on Ubuntu

I want whatever can make rubygems 1.0 work smile

I'm not sure how to remove it completetly - I've uninstalled rubygems 0.94 using apt-get, but I still have lots of rubygems files on the system.

Thanks in advance for any help

Last edited by g0nzo (2007-12-21 13:26:44)

Re: Problem with rubygems on Ubuntu

add this line

require 'rubygems/gem_runner'

after this
require 'rubygems'

in your /usr/bin/ruby file

Re: Problem with rubygems on Ubuntu

yeameen wrote:

add this line

require 'rubygems/gem_runner'

after this
require 'rubygems'

in your /usr/bin/ruby file

you mean in the /usr/bin/gem file, right ?

it doesn't work for me :

/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- sources (LoadError)
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/site_ruby/1.8/rubygems/source_info_cache.rb:6
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/site_ruby/1.8/rubygems/remote_installer.rb:12
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from /usr/local/lib/site_ruby/1.8/rubygems.rb:112:in `manage_gems'
        from /usr/bin/gem:11

Last edited by jpc_001 (2007-12-27 12:55:09)

Re: Problem with rubygems on Ubuntu

Ruby cannon't find the 'rubygems/remote_installer' package.

Re: Problem with rubygems on Ubuntu

I had the same problem and I fixed it by uninstalling apt-get gem and manually installing the latest version.

Re: Problem with rubygems on Ubuntu

Hello, and Season's Greetings

I'm all messed up with Ubuntu Gutsy.  I apt-get removed rails, ruby, gem, and started from scratch.  I configured from source zlib-1.2.3, then was told to apt-get zlib1g-dev, which I did -- nothing doing.

Here's what I've got...

jess@linux:~$ ruby -v
ruby 1.9.0 (2007-12-25 revision 14709) [i686-linux]
jess@linux:~$ gem -v
1.0.1
jess@linux:~$ whereis ruby
ruby: /usr/bin/ruby /usr/bin/ruby1.8 /usr/lib/ruby /usr/local/bin/ruby /usr/local/lib/ruby /usr/share/man/man1/ruby.1.gz
jess@linux:~$ whereis gem
gem: /usr/bin/gem /usr/bin/gem1.8 /usr/local/bin/gem /usr/share/man/man1/gem.1.gz
jess@linux:~$ rails test
The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails
bash: rails: command not found
jess@linux:~$ sudo gem update --system
Updating RubyGems...
Bulk updating Gem source index for: http://gems.rubyforge.org
/usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:386:in `require': no such file to load -- zlib (LoadError)
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:386:in `unzip'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:333:in `block in fetch_index_from'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:329:in `each'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:329:in `fetch_index_from'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:352:in `fetch_bulk_index'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_index.rb:292:in `update'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache_entry.rb:33:in `refresh'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache.rb:135:in `block in refresh'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache.rb:128:in `each'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache.rb:128:in `refresh'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache.rb:40:in `cache'
        from /usr/local/lib/ruby/1.9.0/rubygems/source_info_cache.rb:50:in `search'
        from /usr/local/lib/ruby/1.9.0/rubygems/commands/update_command.rb:67:in `execute'
        from /usr/local/lib/ruby/1.9.0/rubygems/command.rb:136:in `invoke'
        from /usr/local/lib/ruby/1.9.0/rubygems/command_manager.rb:104:in `process_args'
        from /usr/local/lib/ruby/1.9.0/rubygems/command_manager.rb:74:in `run'
        from /usr/local/lib/ruby/1.9.0/rubygems/gem_runner.rb:39:in `run'
        from /usr/local/bin/gem:22:in `<main>'
jess@linux:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Jesse

Re: Problem with rubygems on Ubuntu

To solve it, I reinstalled zlib1g and zlib1g-dev, recompiled ruby1.8.6 and ran ruby setup.rb, now sudo gem update --system and install rails works...

Jesse

Re: Problem with rubygems on Ubuntu

You should rather install Rails using Rubygems than apt-get. Otherwise when updating the system and gems corruption can happen.

Re: Problem with rubygems on Ubuntu

yeameen wrote:

add this line

require 'rubygems/gem_runner'

after this
require 'rubygems'

in your /usr/bin/ruby file

This should be the /usr/bin/gem file.  I had the same problem on ubuntu 7.0 and the above fix  seems to have fixed it. 

I did an 'aptitude remove rubygems', an additional cleanup of everything left over with 'whereis gem' and 'whereis rubygems', and reinstall with the above.

Re: Problem with rubygems on Ubuntu

I had this same /usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError) problem on ubuntu 7.0 and dharmadeveloper solution worked for me:

Place this line

require 'rubygems/gem_runner'

after
require 'rubygems'

in your  /usr/bin/gem file.

Thanks for everyone inputs

kirk out

Last edited by kirk (2008-01-02 18:03:54)

13

Re: Problem with rubygems on Ubuntu

I had the same problem

Freezing to the gems for Rails 2.0.2
rm -rf vendor/rails
mkdir -p vendor/rails
cd vendor/rails
rake aborted!
uninitialized constant Gem::GemRunner

However my /usr/bin/gem file already has the line require 'rubygems/gem_runner'.

I'm using the latest gem version 1.0.1 and latest Rails 2.0.2.

Im using Ubuntu (Feisty).

Re: Problem with rubygems on Ubuntu

I was having a similar problem - updating gems via "gems update --system" cause gems to stop working with the error message as follows

"/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)"

The problem seems to be that updating gems causes a new file called "gem1.8" to be created in usr/bin/ and at the same time it causes file "gem" to stop working (for me "gem1.8 -v" showed the updated version but "gem -v" just crashes).

A solution is to create a symbolic link between gem1.8 and gem via "sudo ln -s /usr/bin/gem1.8 /usr/bin/gem" (you may need to delete the file "gem" first though). See this link for more details and a good walk through ->https://help.ubuntu.com/community/RubyOnRails

This worked for me and I hope it is of some help.

Best wishes,

MB.

Re: Problem with rubygems on Ubuntu

I reinstalled zlib1g and zlib1g-dev, recompiled ruby1.8.6 and ran ruby setup.rb, now sudo gem update --system
or    sudo gem install rails -
the same  such file to load -- zlib error
I'm using Xandros on an Asus EEE pc 701 subnotebook
RESOLVED IT - see
http://forum.eeeuser.com/viewtopic.php? … 83#p257583
Thanks all

Last edited by pdxrod (2008-05-15 12:19:24)

Re: Problem with rubygems on Ubuntu

Hi,

My name is Nora, new here.

I use this website - http://www.fixya.com/support/t914746-ub … ll_problem

90% of the times i find my the solution to my answers there, they have a pretty cool ubuntu section, in which i believe you will be able to solve your problem.

Good luck,
Nora.