Rails 2.0, gem install, Windows => Mongrel Trouble

UPDATE December 20th: Problems are history with new Rubygems 1.0 release. See: Rubygems: Rails 2.0, Mongrel, Windows, solved.

UPDATE December 19th: Rails changeset 8438 fixes the Rails part of this bug but no release 2.0.3 available yet. Rubygems 1.0 is on the way. Wait for the 1.0 release that contains a bugfix. See my comment below for details. Also added links here in the bottom of the article explaining further.

Read this before running gem update –system and before upgrading to Rails 2.0 on windows. The fast one-sentence version: There is a bug in the current windows ruby “gem” release, but you need to upgrade it for Rails 2.0, read below to stay out of trouble.

This Friday’s final release of Rails 2.0 makes everybody eager to upgrade and install. I ran into the same problems as commented in the release note:

48. Ray on 07 Dec 17:58: […]

ERROR: While executing gem … (Zlib::BufError) buffer error

An other error lurks in the background: Rails 2.0 requires rubygems 0.9.4. And standard in the Ruby one-click installer is rubygems 0.9.2 (my installed version: ruby186-25.exe).

Add to this that some commenters suggest to upgrade rubygems to 0.9.5. WARNING: Don’t upgrade Rubygems before you have read which problems it caused me.

[code lang=”ruby”]gem update –system[/code]

gave me rubygems 0.9.5 but caused mongrel to stop working. I described the details in the ruby forum thread: “Mongrel crash on win32“, which basically says that rubygems 0.9.5 forces a native build on windows that don’t work (not on my machine) because i have no compiler installed.

Luis Lavena was great help to me explaining what was going on and how to get pass the problems. Here is what i had to do:

  1. No rubygems 0.9.5 install. Wait for the sequel. If you already did install it, follow Luis’ advice in the forum thread.
  2. Check your current rubygems version:
    [code lang=”ruby”]C:\> gem environment
    RubyGems Environment:
    – VERSION: 0.9.2 (0.9.2)
    – INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
    – GEM PATH:
    – c:/ruby/lib/ruby/gems/1.8
    – REMOTE SOURCES:
    – http://gems.rubyforge.org[/code]
  3. Get ready for Rails 2.0 but start with rubygems 0.9.4.
    Now, here gem update --system gets you 0.9.5, so in stead do as Luis Lavena suggested (steps 4-5)
  4. Download the zip file with rubygems 0.9.4 from rubyforge (direct link)
  5. [code lang=”ruby”]C:\> unzip -q rubygems-0.9.4.zip
    C:\> cd rubygems-0.9.4
    C:\> ruby setup.rb config
    C:\> ruby setup.rb install[/code]
  6. [code lang=”ruby”]C:\> gem environment
    RubyGems Environment:
    – VERSION: 0.9.4 (0.9.4)
    – INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
    – GEM PATH:
    – c:/ruby/lib/ruby/gems/1.8
    – REMOTE SOURCES:
    – http://gems.rubyforge.org[/code]
  7. [code lang=”ruby”]gem update rails -y[/code]

Now everything works as expected. I will eagerly wait for the sequel to rubygems 0.9.5 which would save me for trouble in the future. Don’t know why this should be so difficult to me but much easier to others that could just run “gem update –system” and “gem update rails -y”. But this description above worked for me.

Related info:

Technorati Tags: , , , , ,

17 Responses to “Rails 2.0, gem install, Windows => Mongrel Trouble”

  1. Thorsten Says:

    Thanks for this, it helped me to get monrel 1.1.1 running on Windows.

    I managed to install it while still having gems 0.9.2 installe, but it didn’t start properly. I switched back to 1.0.1 which ran fine for me, and it worked.

    Then i installed Gems 0.9.5 and Rails 2.0, and was stuck with an out-of-date mongrel

    Your post helped me to get everything up-to-date (well except for gem itself :-P)

  2. Ray Case Says:

    Thanks, Jesper. After doing the “gem update –system” my mongrel server was shot.

    Following steps 4,5,6 and 7 above restored my Mongrel server.

    However, on window$, I had to use gem update rails instead of gem update rails -y because the -y failed.

    Thanks again,
    Ray

  3. Marius Popescu Says:

    Thanks very much!
    I saw yesterday night on a personal site (running on windows) that the mongrels are doing something weird: continuously starting and stopping the ruby instances :) Happily, this morning I saw your post and save it for tonight, when I fixed it in 5 minutes:) Nice, mongrels, nice …

    Tak,
    Marius

  4. hari Says:

    Thanks for this info!

  5. inasacu Says:

    hi,

    tried what you suggested and it worked…

    thanks…

  6. Jesper Rønn-Jensen Says:

    I sent an email to Eric Hodel, prompting for a bugfix release that will fix this. Here’s the reply:

    Eric Hodel to me 12:56 AM (9 hours ago)

    On Dec 18, 2007, at 05:13 AM, Jesper Rønn-Jensen wrote:

    > Hi eric,
    > I wanted to post this comment on your rubygems 0.9.5 blog post http://blog.segment7.net/articles/2007/11/19/rubygems-0-9-5
    > There seems to be a problem posting the comment.
    > it gave me this error:
    > “Article points to an item that is no longer available for interaction”

    We should have RubyGems 1.0 out in the next couple days with the various fixes.

  7. Chris Says:

    RubyGems 1.0.0 is out, but I still get the same error with Mongrel_Service. And reverting back to 0.9.4 prevents me from getting Rails (somehow). Is the bug not fixed, or am I encountering a new problem?

  8. Luis Lavena Says:

    @Chris: what error are you getting with mongrel_service? is doing mongrel_rails or when running the service?

  9. Luis Lavena Says:

    Guys, I’ve updated my post related to RubyGems and @mongrel_service@ with instructions to workaround the issues:

    http://blog.mmediasys.com/2007/12/19/latest-rubygems-and-rails-is-a-deadly-combo

    HTH,

    Luis

  10. Jesper Rønn-Jensen Says:

    @Chris, my upgrade revealed no problems. I don’t have mongrel_service installed. But the new rubygems 1.0 just upgraded my ordinary mongrel from 1.1.1 to 1.1.2

    @Luis: thanks a lot for taking your time to investigate and post workarounds

  11. justaddwater.dk | Rubygems: Rails 2.0, Mongrel, Windows, solved Says:

    […] is the time to revoke the install warning Rails 2.0, gem install, Windows => Mongrel Trouble I wrote about December 9th as Rails 2.0 was […]

  12. Chris Says:

    Thanks guys for all this info.

    My problem is not getting the platform selection menu on “gem install mongrel” and “gem install mongrel_service”, the second printing an error message. Since I don’t even get mongrel_service, I can’t apply Luis’s fix (I completely removed my previous ruby directory for a clean install, during the process of figuring out my upgrade problems).

    I guess I’ll wait for the bug fixes before I continue with the upgrade.

    Best regards,

    Chris.

  13. Jesper Rønn-Jensen Says:

    @Chris: Perhaps you should try manually downloading the gem from rubyforge. Put it into any directory and start a dos prompt. Then type

    gem install mongrel_service-0.3.3-mswin32.gem

    I did that for installing rails 2.0.2 with rubygems 0.9.4 (which had similar problems: it showed an error message 404 download error).

    PS. I assume you ran “gem -v” or “gem environment” to confirm you are now on rubygems 1.0?

  14. Chris Says:

    Hi Jesper,

    Being in the same time zone really helps…

    I tried your solution (how do you find out the name of the latest gems?), first without –source, then with two potential sources, but I still get the same error message:

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem
    Updating metadata for 19 gems from http://gems.rubyforge.org
    ……………….
    complete
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem –source http://gems.rubyonrails.org
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem –source http://gems.rubyforge.org
    Bulk updating Gem source index for: http://gems.rubyforge.org
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    My Ruby environment is:

    c:\ruby>gem env
    RubyGems Environment:
    – RUBYGEMS VERSION: 1.0.0 (1.0.0)
    – RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
    – INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
    – RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
    – RUBYGEMS PLATFORMS:
    – ruby
    – x86-mswin32-60
    – GEM PATHS:
    – c:/ruby/lib/ruby/gems/1.8
    – GEM CONFIGURATION:
    – :update_sources => true
    – :verbose => true
    – :benchmark => false
    – :backtrace => false
    – :bulk_threshold => 1000
    – REMOTE SOURCES:
    http://gems.rubyforge.org

    I wonder if the “ruby” platform is screwing things up (do you confirm that it shouldn’t be there since I’m on Windows?).

  15. Chris Says:

    I apologize if you get this message twice: I submitted a comment, but don’t see it on this page…

    Anyway, I tried getting mongrel_service via the file name, like you suggested, with and without sources, but I get the same error message each time:

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem
    Updating metadata for 19 gems from http://gems.rubyforge.org
    ……………….
    complete
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem –source http://gems.rubyonrails.org
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    c:\ruby>gem install mongrel_service-0.3.3-mswin32.gem –source http://gems.rubyforge.org
    Bulk updating Gem source index for: http://gems.rubyforge.org
    ERROR: could not find mongrel_service-0.3.3-mswin32.gem locally or in a repository

    As you can see below, I have the latest RubyGems version, but I’m wondering why I have “ruby” as one of the RubyGems platforms (I’m running on Windows)…

    c:\ruby>gem env
    RubyGems Environment:
    – RUBYGEMS VERSION: 1.0.0 (1.0.0)
    – RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
    – INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
    – RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
    – RUBYGEMS PLATFORMS:
    – ruby
    – x86-mswin32-60
    – GEM PATHS:
    – c:/ruby/lib/ruby/gems/1.8
    – GEM CONFIGURATION:
    – :update_sources => true
    – :verbose => true
    – :benchmark => false
    – :backtrace => false
    – :bulk_threshold => 1000
    – REMOTE SOURCES:
    http://gems.rubyforge.org

  16. Luis Lavena Says:

    @Chris: you’re doing it wrong and getting things wrong.

    A. ‘ruby’ is a pure-ruby platform, used by gems that don’t need or provide specific functionality for each platform, or just ships pre-built extensions for them.

    B. When Jesper suggest you try installing mongrel_service by its filename, he meant: donwload the .gem file from rubyforge and *then* try to install it locally.

    C. installing mongrel_service with 1.0.0 installed shows some problems, not because rubygems, but due how dependencies to win32-service are indicated in mongrel_service gem. so:

    1. downgrade to 0.9.4, following indications posted in this thread my me (in ruby-forum).

    2. install mongrel, mongrel_service.

    3. upgrade (gem system –upgrade)

    4. install rails 2.0.2 gem

    5. follow the rename of the mongrel_service-0.3.3-mswin32 folder indicated in my previous blog post.

    6. you’re done.

    I’ll try to solve mongrel_service issues this weekend. So few days before christmas is a nightmare here at office. Please excuse the troubles.

    HTH,

    Luis

  17. Chris Says:

    Thanks for being so patient Luis.

    I’m off to a well deserved vacation… so I’ll follow your instructions when I get back. In the mean time have a Happy Holiday,

    Chris.