Gems Install Problem

Hi

I just installed gems and after it 'successfully' installed,
it burped. Below are the stats:

ruby -v

ruby 1.8.0 (2003-08-04) [i386-linux-gnu]

uname -a

Linux indigo 2.4.20-20.7smp #1 SMP Mon Aug 18 14:46:14 EDT 2003 i686 unknown

# ruby install.rb
lib/rubygems/version.rb -> /usr/lib/site_ruby/1.8/rubygems/version.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/version.rb
lib/rubygems/validator.rb -> /usr/lib/site_ruby/1.8/rubygems/validator.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/validator.rb
lib/rubygems/user_interaction.rb ->
/usr/lib/site_ruby/1.8/rubygems/user_interaction.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/user_interaction.rb
lib/rubygems/specification.rb ->
/usr/lib/site_ruby/1.8/rubygems/specification.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/specification.rb
lib/rubygems/remote_installer.rb ->
/usr/lib/site_ruby/1.8/rubygems/remote_installer.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb
lib/rubygems/package.rb -> /usr/lib/site_ruby/1.8/rubygems/package.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/package.rb
lib/rubygems/open-uri.rb -> /usr/lib/site_ruby/1.8/rubygems/open-uri.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/open-uri.rb
lib/rubygems/old_format.rb -> /usr/lib/site_ruby/1.8/rubygems/old_format.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/old_format.rb
lib/rubygems/loadpath_manager.rb ->
/usr/lib/site_ruby/1.8/rubygems/loadpath_manager.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/loadpath_manager.rb
lib/rubygems/installer.rb -> /usr/lib/site_ruby/1.8/rubygems/installer.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/installer.rb
lib/rubygems/gem_runner.rb -> /usr/lib/site_ruby/1.8/rubygems/gem_runner.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/gem_runner.rb
lib/rubygems/gem_commands.rb ->
/usr/lib/site_ruby/1.8/rubygems/gem_commands.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/gem_commands.rb
lib/rubygems/format.rb -> /usr/lib/site_ruby/1.8/rubygems/format.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/format.rb
lib/rubygems/doc_manager.rb -> /usr/lib/site_ruby/1.8/rubygems/doc_manager.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/doc_manager.rb
lib/rubygems/config_file.rb -> /usr/lib/site_ruby/1.8/rubygems/config_file.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/config_file.rb
lib/rubygems/command.rb -> /usr/lib/site_ruby/1.8/rubygems/command.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/command.rb
lib/rubygems/cmd_manager.rb -> /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb
lib/rubygems/cache.rb -> /usr/lib/site_ruby/1.8/rubygems/cache.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/cache.rb
lib/rubygems/builder.rb -> /usr/lib/site_ruby/1.8/rubygems/builder.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems/builder.rb
lib/ubygems.rb -> /usr/lib/site_ruby/1.8/ubygems.rb
chmod 0644 /usr/lib/site_ruby/1.8/ubygems.rb
lib/rubygems.rb -> /usr/lib/site_ruby/1.8/rubygems.rb
chmod 0644 /usr/lib/site_ruby/1.8/rubygems.rb

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.

  Successfully built RubyGem
  Name: sources
  Version: 0.0.1
  File: sources-0.0.1.gem
/usr/lib/site_ruby/1.8/rubygems/version.rb:123:in `<=>': undefined method
`to_ints' for nil:NilClass (NoMethodError)
        from /usr/lib/site_ruby/1.8/rubygems/specification.rb:474:in `=='
        from /usr/lib/site_ruby/1.8/rubygems/specification.rb:474:in
`to_ruby'
        from /usr/lib/site_ruby/1.8/rubygems/specification.rb:470:in `each'
        from /usr/lib/site_ruby/1.8/rubygems/specification.rb:470:in
`to_ruby'
        from /usr/lib/site_ruby/1.8/rubygems/installer.rb:115:in `write_spec'
        from /usr/lib/site_ruby/1.8/rubygems/installer.rb:77:in `install'
        from install.rb:144:in `install_rb'
        from install.rb:148

Any ideas?

···

--
Jim Freeze

* jim@freeze.org <jim@freeze.org> [2004-10-13 23:43:45 +0900]:

More problems. While trying to install rails I get the following:

gem install -r rubyonrails

Attempting remote installation of 'rubyonrails'
/usr/lib/site_ruby/1.8/rubygems.rb:116:in `activate': (Gem::LoadError)
Could not find RubyGem sources (> 0.0.0)
        from /usr/lib/site_ruby/1.8/rubygems.rb:34:in `require_gem'
        from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:71:in
`get_cache_sources'
        from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:43:in
`install'
        from /usr/lib/site_ruby/1.8/rubygems/gem_commands.rb:156:in `execute'
        from /usr/lib/site_ruby/1.8/rubygems/command.rb:49:in `invoke'
        from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:90:in
`process_args'
        from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:63:in `run'
        from /usr/lib/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
        from /usr/bin/gem:11

···

--
Jim Freeze

I got this problem too. I think I found the fix. I dug around in the rubygems libraries. This is the line where the error comes from:

   lib/rubygems/specification.rb, line 474
     result << " s.#{name} = #{ruby_code(current_value)}\n" unless current_value == default

You can either setup a default:

   lib/rubygems/specification.rb, line 189
     required_attribute :version, Version.create('0.0.0')

Or you can make version's compare nicely to nihilism:

   lib/rubygems/version.rb, line 122
     def <=>(other)
       return 1 unless other # I figure something is always more than nothing

Either way, things worked for me. I've already forwarded this fix to the rubygems-developers mailing list.

Cheers,

Patrick

···

On Wednesday, October 13, 2004, at 10:43 AM, jim@freeze.org wrote:

Hi

I just installed gems and after it 'successfully' installed,
it burped. Below are the stats:

More problems still... :slight_smile:

Ok, now I have installed ruby-1.8.1 into a local workspace.
Installing gems gives me the following (with the fluff snipped)

...
lib/rubygems.rb -> /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb
chmod 0644 /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.

/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in
`initialize': Permission denied - sources-0.0.1.gem (Errno::EACCES)
        from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in `open'
        from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in `open'
        from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:658:in `open'
        from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:31:in `build'
        from install.rb:143:in `install_rb'
        from install.rb:148

Trying to figure out why I get a Permission denied when it should be
installing into my local ruby install directory.

···

--
Jim Freeze

Jim, you're reporting 3 errors I haven't seen before. If you haven't
gotten help by the end of the day I'll take a look at all of this when
I get home. Busy day in the office today unfortunately.

Thanks,
Chad

···

On Wed, 13 Oct 2004 23:53:54 +0900, jim@freeze.org <jim@freeze.org> wrote:

* jim@freeze.org <jim@freeze.org> [2004-10-13 23:43:45 +0900]:

More problems. While trying to install rails I get the following:

> gem install -r rubyonrails
Attempting remote installation of 'rubyonrails'
/usr/lib/site_ruby/1.8/rubygems.rb:116:in `activate': (Gem::LoadError)
Could not find RubyGem sources (> 0.0.0)
       from /usr/lib/site_ruby/1.8/rubygems.rb:34:in `require_gem'
       from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:71:in
`get_cache_sources'
       from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:43:in
`install'
       from /usr/lib/site_ruby/1.8/rubygems/gem_commands.rb:156:in `execute'
       from /usr/lib/site_ruby/1.8/rubygems/command.rb:49:in `invoke'
       from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:90:in
`process_args'
       from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:63:in `run'
       from /usr/lib/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
       from /usr/bin/gem:11

Thanks, Patrick! It's applied.

···

On Sun, 31 Oct 2004 14:06:35 +0900, Patrick May <patrick@hexane.org> wrote:

On Wednesday, October 13, 2004, at 10:43 AM, jim@freeze.org wrote:

> Hi
>
> I just installed gems and after it 'successfully' installed,
> it burped. Below are the stats:

I got this problem too. I think I found the fix. I dug around in the
rubygems libraries. This is the line where the error comes from:

   lib/rubygems/specification.rb, line 474
     result << " s.#{name} = #{ruby_code(current_value)}\n" unless
current_value == default

You can either setup a default:

   lib/rubygems/specification.rb, line 189
     required_attribute :version, Version.create('0.0.0')

Or you can make version's compare nicely to nihilism:

   lib/rubygems/version.rb, line 122
     def <=>(other)
       return 1 unless other # I figure something is always more than
nothing

Either way, things worked for me. I've already forwarded this fix to
the rubygems-developers mailing list.

Cheers,

Patrick

--

Chad Fowler
http://chadfowler.com

http://rubygems.rubyforge.org (over 20,000 gems served!)

Do a:

gem list

And ensure that the sources gem is present is present.

Likely you need to sudo to install rails though...

sudo gem install -r rails

Let us know the output of gem list...

-rich

···

On 10/13/04 11:21 AM, "Chad Fowler" <chadfowler@gmail.com> wrote:

On Wed, 13 Oct 2004 23:53:54 +0900, jim@freeze.org <jim@freeze.org> wrote:

* jim@freeze.org <jim@freeze.org> [2004-10-13 23:43:45 +0900]:

More problems. While trying to install rails I get the following:

gem install -r rubyonrails

Attempting remote installation of 'rubyonrails'
/usr/lib/site_ruby/1.8/rubygems.rb:116:in `activate': (Gem::LoadError)
Could not find RubyGem sources (> 0.0.0)
       from /usr/lib/site_ruby/1.8/rubygems.rb:34:in `require_gem'
       from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:71:in
`get_cache_sources'
       from /usr/lib/site_ruby/1.8/rubygems/remote_installer.rb:43:in
`install'
       from /usr/lib/site_ruby/1.8/rubygems/gem_commands.rb:156:in `execute'
       from /usr/lib/site_ruby/1.8/rubygems/command.rb:49:in `invoke'
       from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:90:in
`process_args'
       from /usr/lib/site_ruby/1.8/rubygems/cmd_manager.rb:63:in `run'
       from /usr/lib/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
       from /usr/bin/gem:11

Jim, you're reporting 3 errors I haven't seen before. If you haven't
gotten help by the end of the day I'll take a look at all of this when
I get home. Busy day in the office today unfortunately.

Thanks,
Chad

Quickly looking at this, it appears that sources-0.0.1.gem is not
_readable_ by the user you're logged in as. Can you check the
ownership/permissions on that file in your rubygems install directory?

Chad

···

On Thu, 14 Oct 2004 00:10:23 +0900, jim@freeze.org <jim@freeze.org> wrote:

More problems still... :slight_smile:

Ok, now I have installed ruby-1.8.1 into a local workspace.
Installing gems gives me the following (with the fluff snipped)

...
lib/rubygems.rb -> /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb
chmod 0644 /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.

/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in
`initialize': Permission denied - sources-0.0.1.gem (Errno::EACCES)
       from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in `open'
       from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:601:in `open'
       from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:658:in `open'
       from
/disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:31:in `build'
       from install.rb:143:in `install_rb'
       from install.rb:148

Trying to figure out why I get a Permission denied when it should be
installing into my local ruby install directory.

--

* Richard Kilmer <rich@infoether.com> [2004-10-14 00:26:05 +0900]:

Do a:

gem list

This is a fresh install mind you (which is questionable since it had
errors at the end)

    > gem list

    *** LOCAL GEMS ***

And ensure that the sources gem is present is present.

I don't know what this sources gem is. Was that supposed
to be part of the install?

Likely you need to sudo to install rails though...

sudo gem install -r rails

We'll get to this later, but this system does not have sudo
and I don't have access to root, that is why I did the local
ruby install.

Other data that may help in the debug:

    > which ruby
    /disk2/jfn/usr/local/bin/ruby
    > ruby -v
    ruby 1.8.1 (2003-12-25) [i686-linux]
    > which gem
    /disk2/jfn/usr/local/bin/gem
    > gem -v
    0.8.1
    > gem list

    *** LOCAL GEMS ***
    > gem install rubyonrails
    Attempting local installation of 'rubyonrails'
    Local gem file not found: rubyonrails*.gem
    Attempting remote installation of 'rubyonrails'
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:116:in `activate':
    (Gem::LoadError)
    Could not find RubyGem sources (> 0.0.0)
            from /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:34:in
    `require_gem'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:71:in
    `get_cache_sources'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:43:in
    `install'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:156:in
    `execute'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/command.rb:49:in
    `invoke'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:90:in
    `process_args'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:63:in
    `run'
            from
    /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
            from /disk2/jfn/usr/local/bin/gem:11

···

--
Jim Freeze

* Chad Fowler <chadfowler@gmail.com> [2004-10-14 00:36:47 +0900]:

Quickly looking at this, it appears that sources-0.0.1.gem is not
_readable_ by the user you're logged in as. Can you check the
ownership/permissions on that file in your rubygems install directory?

Where should that file be? I can't find it:

    > pwd
    /disk2/jfn/usr/local/lib/ruby/gems
    > find *
    1.8
    1.8/specifications
    1.8/cache
    1.8/gems

···

--
Jim Freeze

It's part of the rubygems installer. So, it should be in the
directory where you untarred the rubygems distribution.

BTW, I did a test with the same version of Ruby you were using,
installing into a local Ruby in my home directory (Fedora linux) and
wasn't able to reproduce the permissions problem.

Chad

···

On Thu, 14 Oct 2004 00:41:29 +0900, jim@freeze.org <jim@freeze.org> wrote:

* Chad Fowler <chadfowler@gmail.com> [2004-10-14 00:36:47 +0900]:

> Quickly looking at this, it appears that sources-0.0.1.gem is not
> _readable_ by the user you're logged in as. Can you check the
> ownership/permissions on that file in your rubygems install directory?

Where should that file be? I can't find it:

   > pwd
   /disk2/jfn/usr/local/lib/ruby/gems
   > find *
   1.8
   1.8/specifications
   1.8/cache
   1.8/gems

* Richard Kilmer <rich@infoether.com> [2004-10-14 00:26:05 +0900]:

> Do a:
>
> gem list
>

This is a fresh install mind you (which is questionable since it had
errors at the end)

   > gem list

   *** LOCAL GEMS ***

> And ensure that the sources gem is present is present.

I don't know what this sources gem is. Was that supposed
to be part of the install?

Yea, it's part of the install. "sources" is the list of remote
repositories. We package it as a gem (right now there's only one, but
doing it as a gem means we can update it remotely later with "gem
update" or "gem install sources").

> Likely you need to sudo to install rails though...
>
> sudo gem install -r rails
>

We'll get to this later, but this system does not have sudo
and I don't have access to root, that is why I did the local
ruby install.

You shouldn't need sudo access if you're running a ruby that is
installed in a place you have access to. I just installed ruby 1.8.1,
rubygems 0.8.1, and then some gems into that local directory. There's
something amuck on your system (not necessarily your system's fault,
of course). Or you might have some part of your configuration in a
state that we haven't seen/tested with RubyGems. Let the hunt
continue :slight_smile: (Thanks for wading through this with us).

Other data that may help in the debug:

   > which ruby
   /disk2/jfn/usr/local/bin/ruby

I'm not sure if this would explain everything, but have you tried
running all of these with explicit full paths to your intended Ruby
interpreter?

   > ruby -v
   ruby 1.8.1 (2003-12-25) [i686-linux]

Same here.

   > which gem
   /disk2/jfn/usr/local/bin/gem
   > gem -v
   0.8.1

Same here too.

   > gem list

   *** LOCAL GEMS ***

Here, I see the sources gem installed, which should be present in
every rubygems installation.

   > gem install rubyonrails
   Attempting local installation of 'rubyonrails'
   Local gem file not found: rubyonrails*.gem
   Attempting remote installation of 'rubyonrails'
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:116:in `activate':
   (Gem::LoadError)
   Could not find RubyGem sources (> 0.0.0)
           from /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:34:in
   `require_gem'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:71:in
   `get_cache_sources'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/remote_installer.rb:43:in
   `install'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_commands.rb:156:in
   `execute'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/command.rb:49:in
   `invoke'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:90:in
   `process_args'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/cmd_manager.rb:63:in
   `run'
           from
   /disk2/jfn/usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:9:in `run'
           from /disk2/jfn/usr/local/bin/gem:11

This is because it's trying to go download the rails gem, but it can't
load the sources definition to see where to go get the rails gem from.
It's all caused by the permissions problem you have while running
install.rb

Thanks for your patience,
Chad

···

On Thu, 14 Oct 2004 00:38:28 +0900, jim@freeze.org <jim@freeze.org> wrote:

* Chad Fowler <chadfowler@gmail.com> [2004-10-14 01:17:07 +0900]:

It's part of the rubygems installer. So, it should be in the
directory where you untarred the rubygems distribution.

That was the problem. It was owned by root.
So, geneology was this:

1) Tried to install gems into /usr/local/ with su
2) #1 failed
3) Built and installed local version of ruby w/o root.
4) installed gems (failed)

So, if I had sudo and had used 'sudo ruby install.rb' to install
gems, would the permissions for source not been root?

This explains why #3 failed, but not #1.

···

--
Jim Freeze

* Chad Fowler <chadfowler@gmail.com> [2004-10-14 01:17:07 +0900]:

> It's part of the rubygems installer. So, it should be in the
> directory where you untarred the rubygems distribution.

That was the problem. It was owned by root.
So, geneology was this:

1) Tried to install gems into /usr/local/ with su
2) #1 failed

At this point, the sources gem was actually _built_ by the installer
(as root). It gets built from a specification whenever you run
install.rb. So the .gem file was generated as root and therefore
inaccessible (as per your umask) to other users.

3) Built and installed local version of ruby w/o root.
4) installed gems (failed)

So, if I had sudo and had used 'sudo ruby install.rb' to install
gems, would the permissions for source not been root?

This explains why #3 failed, but not #1.

--

I'm glad we know why #3 failed. I'm still unsure on #1. I see where
this is happening in the code, but it may take some more focused time
to track down how it could have gotten in this state.

Perhaps Gavin could help on this front, as the specification stuff is
probably best understood by him as of now.

Chad

···

On Thu, 14 Oct 2004 01:27:13 +0900, jim@freeze.org <jim@freeze.org> wrote: