Ruby Gem Install problems on Windows XP

Ted Finch's Avatar

Ted Finch

29 Nov, 2011 06:31 PM

I am trying to install Ruby, Ruby on Rails and RubyGems. Following the instructions here: http://rubyonrails.org/download

I have downloaded rubygems-1.8.11 and run gem setup.rb

There are 7 gems listed if I run gem server:
bigdecimal, io-console, json, minitest, rake, rdoc, rubygems.

An attempt to install rails gives this:

C:\Ruby193>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)

Errno::ETIMEDOUT: A connection attempt failed because the connected party di

d not properly respond after a period of time, or established connection failed
because connected host has failed to respond. - connect(2) (http://rubygems.org/
latest_specs.4.8.gz)

Any guidance would be welcomed.

  1. Support Staff 2 Posted by Luis Lavena on 29 Nov, 2011 07:17 PM

    Luis Lavena's Avatar

    Hello,

    Most likely you're behind a proxy/firewall that is blocking downloads from rubygems.org and its CDN (Amazon CloudFront)

    Please use HTTP_PROXY environment variable or use --http-proxy option during gem installation.

    See previous thread on this subject:

    http://help.rubygems.org/discussions/problems/771-installation-of-w...

  2. 3 Posted by Nobody on 29 Nov, 2011 08:14 PM

    Nobody's Avatar

    Luis

    Thanks for the reply.

    I am not aware of any firewall running nor a oroxy connection . I am at home
    with a broadband ( ADSL ) connection.

    If Gem is trying to connect to a remote server which I can 'see' what port
    is being used.

    Can you give me some more information on Please "HTTP_PROXY environment
    variable or use `--http-proxy` option during gem installation" as I cant
    undersatnd how that might help.

    Thanks

    Ted

  3. 4 Posted by Nobody on 29 Nov, 2011 08:46 PM

    Nobody's Avatar

    Luis

    Thanks for the reply.

    I don't think I am accessing the internet via a proxy server. I have never
    had to use a setting such as http://user:pass@proxy:port for internet access
    of any kind.

    Can you tell me what protocol and port gem is designed to use? If for any
    reason my ISP is blocking a port I will need to advise them.

    Thanks

  4. Support Staff 5 Posted by Luis Lavena on 29 Nov, 2011 09:18 PM

    Luis Lavena's Avatar

    Do you have a proxy set in your browser?

    Can you visit rubygems.org, find any gem and download it?

    I thought the link I provided to you provided enough information on how to use HTTP_PROXY environment variable or using --http-proxy option.

    Did you read my response?

    In the example I used http://user:pass@proxy:port which should be replaced by the username and password the host and the port used by your proxy.

    All this under the assumption you're behind a proxy that is limiting you to download RubyGems metadata.

  5. 6 Posted by Nobody on 29 Nov, 2011 09:32 PM

    Nobody's Avatar

    I understand the concept of a proxy server but I don't use a proxy server to
    access the internet.

    I have a home LAN, a broadband connection to my ISP and then the internet.

    For example I can ping the server directly.

    C:\Documents and Settings\Ted>ping rubygems.org

    Pinging rubygems.org [72.4.120.124] with 32 bytes of data:

    Reply from 72.4.120.124: bytes=32 time=106ms TTL=49
    Reply from 72.4.120.124: bytes=32 time=107ms TTL=49
    Reply from 72.4.120.124: bytes=32 time=112ms TTL=49
    Reply from 72.4.120.124: bytes=32 time=114ms TTL=49

    Ping statistics for 72.4.120.124:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 106ms, Maximum = 114ms, Average = 109ms

  6. Support Staff 7 Posted by Luis Lavena on 29 Nov, 2011 09:38 PM

    Luis Lavena's Avatar

    I understand the concept of a proxy server but I don't use a proxy server to access the internet.

    You're not answering what I asked you to do.

    I didn't ask you to ping rubygems.org I specifically asked you to visit rubygems.org and download any gem.

    Gems are served after a redirect from Amazon CloudFront/S3, and if you can't access it, then RubyGems can download them.

    Also, please execute the same gem install command with -V --debug option:

    gem install rails --debug -V

    And create a pastie/gist of the output, that will be very helpful for us to debug.

    Remember: we can't reproduce or help you better if you don't help us to help you. The more related information you provide, the better.

  7. 8 Posted by Nobody on 29 Nov, 2011 09:53 PM

    Nobody's Avatar

    Luis

    I have downloaded the zip file rubygems-1.8.11.zip and run setup.rb . This
    takes a while to run but does not seem to increase the installed gems - I am
    not sure where the files are going if they are being installed.

    Gem e gives

    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.11
      - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i386-mingw32]
      - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
      - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
      - EXECUTABLE DIRECTORY: C:/Ruby193/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-mingw32
      - GEM PATHS:
         - C:/Ruby193/lib/ruby/gems/1.9.1
         - C:/Documents and Settings/Ted/.gem/ruby/1.9.1
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/

    I have downloaded json-1.6.2.gem OK just now from but not installed it yet

    Thanks

    Ted

  8. 9 Posted by Nobody on 29 Nov, 2011 10:06 PM

    Nobody's Avatar

    This is the verbose output

    C:\Ruby193>gem install rails --debug -V
    Exception `NameError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_ma
    nager.rb:177 - uninitialized constant Gem::Commands::InstallCommand
    Exception `Gem::LoadError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/depen
    dency.rb:247 - Could not find psych (>= 1.2.1, ~> 1.2) amongst
    [bigdecimal-1.1.0
    , io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4]
    Exception `NoMethodError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/packag
    e/tar_input.rb:57 - undefined method `readpartial' for
    #<Gem::Package::TarReader
    ::Entry:0x109cb48>
    Exception `NoMethodError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specif
    ication.rb:574 - undefined method `readpartial' for
    #<Gem::Package::TarReader::E
    ntry:0x109cb48>
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    1 - invalid value for Integer(): "2.3.3"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    2 - invalid value for Float(): "2.3.3"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    1 - invalid value for Integer(): "0.8.3"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    2 - invalid value for Float(): "0.8.3"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    1 - invalid value for Integer(): "--exclude"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    2 - invalid value for Float(): "--exclude"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    1 - invalid value for Integer(): "."
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    2 - invalid value for Float(): "."
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    1 - invalid value for Integer(): "1.3.1"
    Exception `ArgumentError' at
    C:/Ruby193/lib/ruby/1.9.1/psych/scalar_scanner.rb:7
    2 - invalid value for Float(): "1.3.1"
    Exception `IOError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/format.rb:45
     - closed stream
    Exception `Errno::ETIMEDOUT' at C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762 -
    A co
    nnection attempt failed because the connected party did not properly respond
    aft
    er a period of time, or established connection failed because connected host
    has
     failed to respond. - connect(2)
    Exception `Gem::RemoteFetcher::FetchError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.
    1/rubygems/remote_fetcher.rb:239 - Errno::ETIMEDOUT: A connection attempt
    failed
     because the connected party did not properly respond after a period of
    time, or
     established connection failed because connected host has failed to respond.
    - c
    onnect(2) (http://rubygems.org/latest_specs.4.8.gz)
    Error fetching remote data: Errno::ETIMEDOUT: A connection
    attempt f
    ailed because the connected party did not properly respond after a period of
    tim
    e, or established connection failed because connected host has failed to
    respond
    . - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
    Falling back to local-only install
    Exception `NoMethodError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specif
    ication.rb:1473 - undefined method `to_ary' for #<Gem::Specification
    name=rails
    version=2.3.3>
    Exception `NoMethodError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specif
    ication.rb:1473 - undefined method `to_ary' for #<Gem::Specification
    name=rails
    version=2.3.3>
    Exception `Gem::DependencyError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems
    /dependency_installer.rb:153 - Unable to resolve dependencies: rails
    requires ac
    tivesupport (= 2.3.3), activerecord (= 2.3.3), actionpack (= 2.3.3),
    actionmaile
    r (= 2.3.3), activeresource (= 2.3.3)
    ERROR: While executing gem ... (Gem::DependencyError)
        Unable to resolve dependencies: rails requires activesupport (= 2.3.3),
    acti
    verecord (= 2.3.3), actionpack (= 2.3.3), actionmailer (= 2.3.3),
    activeresource
     (= 2.3.3)
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:153
    :in `gather_dependencies'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:267
    :in `install'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb
    :121:in `block in execute'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb
    :115:in `each'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb
    :115:in `execute'
            C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:278:in
    `invoke'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:147:in `
    process_args'
     
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:117:in `
    run'
            C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:65:in
    `run'
            C:/Ruby193/bin/gem:21:in `<main>'

    C:\Ruby193>

  9. 10 Posted by Nobody on 29 Nov, 2011 11:17 PM

    Nobody's Avatar

    Do you have any further thoughts ?

    Thanks

    Ted

  10. Support Staff 11 Posted by Luis Lavena on 30 Nov, 2011 12:11 AM

    Luis Lavena's Avatar

    From this:

    Exception `Gem::RemoteFetcher::FetchError' at
    C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/remote_fetcher.rb:239 -
    Errno::ETIMEDOUT: A connection attempt
    failed because the connected party did not properly respond after a
    period of time, or established connection failed because connected
    host has failed to respond.
    - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
    Error fetching remote data: Errno::ETIMEDOUT: A connection
    attempt failed because the connected party did not properly respond
    after a period of time, or established connection failed because
    connected host has failed to respond. - connect(2)
    (http://rubygems.org/latest_specs.4.8.gz)
    Falling back to local-only install

    It seems your network connection might time out when attempting to
    download files from Amazon.

    Can you try the following?

    >> require "open-uri"
    => true
    >> f = open("http://rubygems.org/latest_specs.4.8.gz&quot;)
    => #<File:C:/Users/Luis/AppData/Local/Temp/open-uri20111129-3452-gpwr7t>
    >> d = f.read; nil
    => nil
    >> d.length
    => 267528
    >> f.close
    => nil
    >>

    Things with ">>" are the commands I entered at IRB and => are the
    responses. You should be obtaining something similar. Please use "irb"
    (Either from the command prompt or from the start menu as "Interactive
    Ruby")

  11. 12 Posted by Nobody on 30 Nov, 2011 12:44 AM

    Nobody's Avatar

    I think you may be correct about the timeout. F would seem to remain as nil

    Ted

     irb(main):001:0> require "open-uri"
    => true
    irb(main):002:0> f = open("http://rubygems.org/latest_specs.4.8.gz&quot;)
    Errno::ETIMEDOUT: A connection attempt failed because the connected party
    did no
    t properly respond after a period of time, or established connection failed
    beca
    use connected host has failed to respond. - connect(2)
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize'
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
            from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
            from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
            from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:306:in `open_http'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:775:in `buffer_open'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:203:in `block in
    open_loop'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `catch'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:677:in `open'
            from C:/Ruby193/lib/ruby/1.9.1/open-uri.rb:33:in `open'
            from (irb):2
            from C:/Ruby193/bin/irb:12:in `<main>'irb(main):003:0>
    irb(main):004:0* d = f.read; nil
    NoMethodError: undefined method `read' for nil:NilClass
            from (irb):4
            from C:/Ruby193/bin/irb:12:in `<main>'
    irb(main):005:0> d.length
    NoMethodError: undefined method `length' for nil:NilClass
            from (irb):5
            from C:/Ruby193/bin/irb:12:in `<main>'
    irb(main):006:0> f.close
    NoMethodError: undefined method `close' for nil:NilClass
            from (irb):6
            from C:/Ruby193/bin/irb:12:in `<main>'
    irb(main):007:0>

  12. 13 Posted by Nobody on 30 Nov, 2011 12:55 AM

    Nobody's Avatar

    Luis

    I am not sure what time zone you are in. We have been at this for 7 hours.
    It is almost 1:00am GMT with me. Perhaps we can catch up later.

    Thanks for your help so far

    Ted

  13. Support Staff 14 Posted by Luis Lavena on 30 Nov, 2011 01:58 AM

    Luis Lavena's Avatar

    Sorry for taking longer to respond. I'm utc -3 (11pm right now)

    Dunno how else we can verify this issue but seems your computer is having
    issues to download these files from rubygems website.

  14. 15 Posted by Nobody on 30 Nov, 2011 03:33 PM

    Nobody's Avatar

    Luis

    I think we are agreed on the problem even if a solution is not yet
    available.

    In the meantime could you clarify how I might achieve this installation of
    Ruby and Ruby on Rails manually. I have downloaded the rails zip file. The
    online instructions are brief.

    RubyGems: Download, extract, then run "ruby setup.rb"

    With the problems I am having to get an installation set up a little more
    guidance of what to do and what to expect to happen would be welcomed.

    Thanks

    Ted

  15. Support Staff 16 Posted by Luis Lavena on 30 Nov, 2011 03:48 PM

    Luis Lavena's Avatar

    To manually install rails will be a bit complicated.

    First you will need to download rails.gem from rubygems.org:

    http://rubygems.org/gems/rails

    And the same for Rails dependencies (listed in the Runtime Dependencies column)

    After that, place all the .gem files in one directory, cd into it, and execute:

    gem install --local rails*.gem

    That will install all the gems using the local directory as source of
    the dependencies.

    Please note that things might get a bit complicated as you will have
    to download also the dependencies of the dependencies.

    An alternative that I can suggest you, since you want to try Rails is
    download and install RailsInstaller:

    http://railsinstaller.org/

    Which already have all the gems and include a sample application to
    get you started.

    Please uninstall your existing Ruby installation and use that instead
    (since it packs Ruby, RubyGems and Rails)

    As for rubyonrails.org instructions, RubyGems download is not required
    with Ruby 1.9.3 or any RubyInstaller/RailsInstaller releases -- it is
    already bundled.

    Hope that helps.

    >

  16. 17 Posted by Nobody on 30 Nov, 2011 03:56 PM

    Nobody's Avatar

    Thanks.

    I will try the bundle first and if that does not work the hand cranked
    process.

    Ted

  17. 18 Posted by Nobody on 30 Nov, 2011 06:21 PM

    Nobody's Avatar

    Luis ( and any one else that reads this far)

    I started again from scratch.

    First I disabled Windows firewall and set up Comodo as my firewall.
    http://www.comodo.com/home/internet-security/free-internet-security.php

    I downloaded railsinstaller from http://railsinstaller.org/ , installed it
    and followed the tasks as described in the video.

    The install went OK, then I created a new application by entering "rails new
    ridemo" at the command prompt - OK

    Then to test this entered "rails s" at the command prompt.

    I got an error here as no JavaScript runtime was available. I went to
    https://github.com/sstephenson/execjs and then http://nodejs.org/ to
    download the NODE windows installer. (I also ran the command "gem install
    execjs" to install execjs - not sure if this was necessary.)

    I also went here
    http://answers.microsoft.com/en-us/windows/forum/windows_xp-system/repair-wi
    ndows-script-host-wshscripting-in-xp-sp3/eca2f65e-fc00-47da-a5b2-d2f0a3a57cd
    6 (scroll down to the answer) and followed instructions to register script
    dlls with windows.

    At this stage I rebooted my PC.

    Back to the command prompt. CD c:\sites\ridemo and enter rails s

    I went to Comodo to see what was happening on my Active Connections - after
    a few seconds I saw that ruby.exe was listening on TCP port 3000

    In my web browser I entered the URL localhost:3000 and received the cheery
    message:
    "Welcome aboard You're riding Ruby on Rails!"

    Conclusion

    Yesterdays problems above were probably caused by Windows Firewall - even
    though I had disabled it at times!!

    Comodo let me monitor network traffic and I could see that connections were
    being made.

    Not sure why the JavaScript runtime was an issue but the actions above did
    resolve it.

    So thanks for your patience. I hope this helps others.

  18. Support Staff 19 Posted by Luis Lavena on 30 Nov, 2011 06:26 PM

    Luis Lavena's Avatar

    Happy to hear this worked.

    execjs should be using Windows own jscript engine instead of requiring node, but seems that newer nodejs make things more easy.

    Sometimes firewalls and proxies are the problem :P

    Closing this now.

  19. Luis Lavena closed this discussion on 30 Nov, 2011 06:26 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac