Unncessary dependency installation

Michael's Avatar


04 Feb, 2011 11:13 PM

RubyGems 1.5.0 but issue also occurs on 1.3.7

I have rails gem version 2.3.10 installed, no other versions present.
When installing paperclip gem, activerecord/support 3.0.3/+others were installed as paperclip dependency - I checked gem spec and it says activerecord >= 0 and activesupport >= 0
I uninstalled unwanted gems...
When I downloaded gem file and installed via "gem install paperclip-2.3.8.gem -l -V" , I got no errors about dependencies.

Is this known gem issue - always installing newest available gems specified in dependencies, even if local gems fulfill deps?

  1. 1 Posted by Luis Lavena on 05 Feb, 2011 12:21 AM

    Luis Lavena's Avatar

    Correct, that is current behavior.

    I would recommend you use something like Bundler or Isolate to better
    manage your dependencies:


    These tools are designed to resolve the dependencies for you.

  2. 2 Posted by ariel on 08 Feb, 2011 06:07 AM

    ariel's Avatar


    Bundler is a useful tool for managing dependencies, however the Gem::Specification#add_dependency method does not work as documented. Although it accepts an argument that allows the user to specify the version information, it fetches the incorrect dependency versions of gems upon installation. Is there a plan to fix this?

    spec = Gem::Specification.new do |s|
    .... s.add_dependency 'activerecord', '>=2.3.10' s.add_dependency 'activesupport', '>=2.3.10' ...


    ariel@bloodchoke tmp$ gem install paperclip-2.3.6.gem
    Fetching: activesupport-3.0.3.gem (100%)
    Fetching: builder-2.1.2.gem (100%)
    Fetching: i18n-0.5.0.gem (100%)
    Fetching: activemodel-3.0.3.gem (100%)
    Fetching: arel-2.0.7.gem (100%)
    Fetching: tzinfo-0.3.24.gem (100%)
    Successfully installed activesupport-3.0.3
    Successfully installed avalentin-paperclip-2.3.6
    Successfully installed builder-2.1.2
    Successfully installed i18n-0.5.0
    Successfully installed activemodel-3.0.3
    Successfully installed arel-2.0.7
    Successfully installed tzinfo-0.3.24
    7 gems installed

  3. Support Staff 3 Posted by Eric Hodel on 08 Feb, 2011 10:19 PM

    Eric Hodel's Avatar

    = 2.3.10 includes 3.0.4, 10.100 or any other version greater than or equal to 2.3.10. If you wish to restrict it to particular version range use ~> or some other composite requirement.

    See Gem::Requirement and Gem::Version:



    gem install installing the latest versions is not considered a bug.

  4. Eric Hodel closed this discussion on 08 Feb, 2011 10:19 PM.

  5. ariel re-opened this discussion on 10 Feb, 2011 05:26 AM

  6. 4 Posted by ariel on 10 Feb, 2011 05:26 AM

    ariel's Avatar

    After I reviewed my previous post I realized two things. First, I did not realize how terrible the formatting of my previous comment was, and second I failed at expressing my concern in a particular situation.

    When I specify gem requirements using >= my expectation is that if I already have a gem installed, which satisfies that dependency, then it should not install newer versions of the gem. In my previous example I have changed the paperclip specification to use >= 2.3.10, which are already installed.

    However, when I install them gem it installs for the latest version (of some) of it's dependencies. In my case, it ignores activerecord because I already have 2.3.10 installed but it seems to ignore activesupport.

    s.add_dependency 'activerecord', '>=2.3.10' s.add_dependency 'activesupport', '>=2.3.10'

    ariel@bloodchoke dependency$ gem list


    activerecord (2.3.10)
    activesupport (2.3.10)
    rake (0.8.7)
    rdoc (2.5.8)
    rubygems-update (1.5.0)

    ariel@bloodchoke dependency$ gem install paperclip-2.3.6.gem --no-rdoc --no-ri
    Fetching: activesupport-3.0.4.gem (100%)
    Fetching: builder-2.1.2.gem (100%)
    Fetching: i18n-0.5.0.gem (100%)
    Fetching: activemodel-3.0.4.gem (100%)
    Fetching: arel-2.0.8.gem (100%)
    Fetching: tzinfo-0.3.24.gem (100%)
    Successfully installed activesupport-3.0.4
    Successfully installed paperclip-2.3.6
    Successfully installed builder-2.1.2
    Successfully installed i18n-0.5.0
    Successfully installed activemodel-3.0.4
    Successfully installed arel-2.0.8
    Successfully installed tzinfo-0.3.24
    7 gems installed

    I thought that maybe activesupport has other dependencies that may cause a problem, but installing it on its own does not seem to require anything:

    ariel@bloodchoke repos$ gem install activesupport -v=2.3.10
    Fetching: activesupport-2.3.10.gem (100%)
    Successfully installed activesupport-2.3.10
    1 gem installed
    Installing ri documentation for activesupport-2.3.10...
    Installing RDoc documentation for activesupport-2.3.10...

    I hope that clarifies what I was trying to say in my previous post.

  7. 5 Posted by ariel on 13 Feb, 2011 11:35 PM

    ariel's Avatar

    Here is more output using conservative flag and it still installs the incorrect dependencies. I have not had much time to try and narrow down the issue, but when I can I will post it here.

    ariel@bloodchoke tmp$ gem list


    activemodel (3.0.4)
    activerecord (2.3.10)
    activesupport (3.0.4, 2.3.10)
    arel (2.0.8)
    builder (2.1.2)
    i18n (0.5.0)
    paperclip (2.3.6)
    tzinfo (0.3.24)

  8. 6 Posted by Luis Lavena on 23 May, 2011 09:43 PM

    Luis Lavena's Avatar


    Checking this out, RubyGems 1.7.x and 1.8.x provided better support for depedencies.

    Still, RubyGems will attempt to download newer version of a gem depedency if >= is defined as version requirement.

    If you sorted out your issue in relation to gem dependencies, please let us know.

    If you believe this needs to be changed, please open a feature request (if none exist) on RubyGems bug tracker.


    And will be better if you can provide a patch for it.

    Let us know so we can close this out.

    Thank you.

  9. 7 Posted by ariel on 24 May, 2011 02:58 PM

    ariel's Avatar

    Thanks for responding Luis. I have not had time to find the root cause but I
    will do my best to try and get a patch in by this weekend.

    On Mon, May 23, 2011 at 5:43 PM, Luis Lavena <
    [email blocked]> wrote:

  10. Support Staff 8 Posted by Nick Quaranto on 27 May, 2011 12:33 AM

    Nick Quaranto's Avatar

    Closing this out so we can clear our queue. As usual, pull requests are accepted!


  11. Nick Quaranto closed this discussion on 27 May, 2011 12:33 AM.

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

Keyboard shortcuts


? 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