nsidc / vagrant-vsphere

VMware vSphere provider for Vagrant
Other
608 stars 166 forks source link

nokogiri conflict on Windows #25

Open ringods opened 10 years ago

ringods commented 10 years ago

The vsphere plugin doesn't work on my system due to a conflict with another version of nokogiri already installed as a dependency of another vagrant plugin:

ERROR root: Failed to load plugin: vagrant-vsphere
ERROR root:  -- Error: #<Gem::LoadError: Unable to activate vagrant-vsphere-0.5.1, because nokogiri-1.6.0-x86-mingw32 conflicts with nokogiri (= 1.5.10)>
ERROR root:  -- Backtrace:
ERROR root: C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts'
C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
C:/Tools/Vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant.rb:193:in `require_plugin'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/environment.rb:744:in `block in load_plugins'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/environment.rb:741:in `each'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/environment.rb:741:in `load_plugins'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/environment.rb:132:in `initialize'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/bin/vagrant:74:in `new'
C:/Tools/Vagrant/embedded/gems/gems/vagrant-1.3.5/bin/vagrant:74:in `<top (required)>'
C:/Tools/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `load'
C:/Tools/Vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `<main>'
 INFO interface: error: Failed to load the "vagrant-vsphere" plugin. View logs for more details.

Setup:

Here are all the references to nokogiri in the gemspec files of my locally installed plugins or its dependencies:

Searching 48 files for "nokogiri"

C:\Users\ringo_000\.vagrant.d\gems\gems\akami-1.2.0\akami.gemspec:
   15  
   16    s.add_dependency "gyoku", ">= 0.4.0"
   17:   s.add_dependency "nokogiri", ">= 1.4.0"
   18  
   19    s.add_development_dependency "rake",    "~> 0.8.7"

C:\Users\ringo_000\.vagrant.d\gems\gems\nori-1.1.5\nori.gemspec:
   15  
   16    s.add_development_dependency "rake",     "~> 0.8.7"
   17:   s.add_development_dependency "nokogiri", ">= 1.4.0"
   18    s.add_development_dependency "rspec",    "~> 2.5.0"
   19  

C:\Users\ringo_000\.vagrant.d\gems\gems\savon-0.9.5\savon.gemspec:
   21    s.add_dependency "akami",    "~> 1.0"
   22    s.add_dependency "gyoku",    ">= 0.4.0"
   23:   s.add_dependency "nokogiri", ">= 1.4.0"
   24  
   25    s.add_development_dependency "rake",    "~> 0.8.7"

C:\Users\ringo_000\.vagrant.d\gems\gems\vagrant-vsphere-0.5.1\vSphere.gemspec:
   12    s.description = 'Enables Vagrant to manage machines with VMWare vSphere.'
   13    
   14:   # force the use of Nokogiri 1.5.10 to prevent conflicts with older versions of zlib
   15:   s.add_dependency 'nokogiri', '1.5.10'
   16    s.add_dependency 'rbvmomi'
   17    s.add_dependency 'i18n', '~> 0.6.4'

C:\Users\ringo_000\.vagrant.d\gems\gems\wasabi-1.0.0\wasabi.gemspec:
   14    s.rubyforge_project = s.name
   15  
   16:   s.add_dependency "nokogiri", ">= 1.4.0"
   17  
   18    s.add_development_dependency "rake",    "~> 0.8.7"

C:\Users\ringo_000\.vagrant.d\gems\gems\winrm-1.1.3\winrm.gemspec:
   27    s.add_runtime_dependency  'gssapi', '~> 1.0.0'
   28    s.add_runtime_dependency  'httpclient', '~> 2.2', '>= 2.2.0.2'
   29:   s.add_runtime_dependency  'nokogiri', '~> 1.5'
   30    s.add_runtime_dependency  'rubyntlm', '~> 0.1.1'
   31    s.add_runtime_dependency  'uuidtools', '~> 2.1.2'

7 matches across 6 files

Can you make a new release of the plugin that sets a minimum version of nokogiri instead of locking it to 1.5.10?

patatepartie commented 10 years ago

Same problem on MacOS X:

ERROR root:  -- Error: #<Gem::LoadError: Unable to activate vagrant-vsphere-0.5.1, because nokogiri-1.6.0 conflicts with nokogiri (= 1.5.10)>
catharsis commented 10 years ago

From the README: The plugin forces use of Nokogiri 1.5.10 to prevent conflicts with older versions of system libraries, specifically zlib.

@agrauch What type of conflict is that? Would it be possible to solve any other way?

agrauch commented 10 years ago

We were seeing errors when installing the plugin on an enterprise SUSE server. We believe the problem involved compiling nokogiri against the libxml2/zlib libraries included with Vagrant and linking or running with libxml2/zlib installed on the system. This same issue was reported by another user here: https://groups.google.com/forum/#!msg/vagrant-up/KprN9tQtT34/asJDFdfoDoYJ. Another vagrant plugin ran into a similar issue and solved it by locking the nokogiri version: https://github.com/pradels/vagrant-libvirt/pull/63.

Locking the nokogiri version solved the issue on SUSE machine and on our MacOS X development machines. Admittedly, I don't have other vagrant plugins installed that require nokogiri. Although I do have nokogiri 1.6.0 and 1.15.10 installed.

I'm not sure how to solve this one. Conditionally setting the version of nokogiri based on the system would be cool but I have no idea how to do this.

sneal commented 10 years ago

I ran into this same problem. Unsurprisingly I had vagrant-windows installed first and then installed vagrant-vsphere. Vagrant would fail to load the vagrant-vsphere plugin because of the newer Nokogiri version. However I do have a hacky workaround

  1. Uninstall all of your vagrant plugins
  2. vagrant plugin install vagrant-vsphere
  3. vagrant plugin install vagrant-windows (or whatever other plugins that use Nokogiri)

If you install vagrant-vsphere first it will install nokogiri 1.5.10. Other gems will see this version and not bother upgrading it. This worked both on my Mac and Ubuntu 12.04. Everyone wins.

That being said I'd rather change vagrant-vsphere gemspec to not require the older version of Nokogiri.

samueltbrown commented 10 years ago

+1 for @sneal workaround. I uninstalled/reinstalled my plugins starting with vagrant-vsphere and was able to get it working. Thanks!