Unncessary dependency installation
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?
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Luis Lavena on 05 Feb, 2011 12:21 AM
Correct, that is current behavior.
I would recommend you use something like Bundler or Isolate to better
manage your dependencies:
http://gembundler.com/
https://github.com/jbarnette/isolate
These tools are designed to resolve the dependencies for you.
3 Posted by ariel on 08 Feb, 2011 06:07 AM
@Luis,
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' ...
end
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
....
Support Staff 4 Posted by Eric Hodel on 08 Feb, 2011 10:19 PM
See Gem::Requirement and Gem::Version:
http://rubygems.rubyforge.org/rubygems-update/Gem/Requirement.html
http://rubygems.rubyforge.org/rubygems-update/Gem/Version.html
gem installinstalling the latest versions is not considered a bug.Eric Hodel closed this discussion on 08 Feb, 2011 10:19 PM.
ariel re-opened this discussion on 10 Feb, 2011 05:26 AM
5 Posted by ariel on 10 Feb, 2011 05:26 AM
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.
e.g.
s.add_dependency 'activerecord', '>=2.3.10' s.add_dependency 'activesupport', '>=2.3.10'
ariel@bloodchoke dependency$ gem list
LOCAL GEMS
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.
6 Posted by ariel on 13 Feb, 2011 11:35 PM
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
LOCAL GEMS
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)
Support Staff 7 Posted by Luis Lavena on 23 May, 2011 09:43 PM
Hello,
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.
http://rubyforge.org/tracker/?group_id=126
And will be better if you can provide a patch for it.
Let us know so we can close this out.
Thank you.
8 Posted by ariel on 24 May, 2011 02:58 PM
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:
Support Staff 9 Posted by Nick Quaranto on 27 May, 2011 12:33 AM
Closing this out so we can clear our queue. As usual, pull requests are accepted!
http://github.com/rubygems/rubygems
Nick Quaranto closed this discussion on 27 May, 2011 12:33 AM.