hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.28k stars 4.43k forks source link

Unable to install vagrant-libvirt plugin due to gem conflict: excon-0.109.0 vs excon (~> 1.0) #13537

Closed pakosaan closed 5 days ago

pakosaan commented 1 week ago

Debug output

Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
/opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/specification.rb:2288:in `raise_if_conflicts': Unable to activate fog-core-2.6.0, because excon-0.109.0 conflicts with excon (~> 1.0) (Gem::ConflictError)
    from /opt/vagrant/embedded/lib/ruby/3.1.0/rubygems/specification.rb:1419:in `activate'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/bundler.rb:769:in `block in activate_solution'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/bundler.rb:766:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/bundler.rb:766:in `activate_solution'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/bundler.rb:606:in `internal_install'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/bundler.rb:358:in `install'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/plugin/manager.rb:141:in `block in install_plugin'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/plugin/manager.rb:151:in `install_plugin'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/action/install_gem.rb:33:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/warden.rb:38:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/builder.rb:183:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/util/busy.rb:22:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/action/runner.rb:104:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/command/base.rb:17:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/command/install.rb:73:in `block in execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/command/install.rb:72:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/command/install.rb:72:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/commands/plugin/command/root.rb:69:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/cli.rb:67:in `execute'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/lib/vagrant/environment.rb:319:in `cli'
    from /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/bin/vagrant:248:in `<main>'

Expected behavior

The plugin to be installed successfully and show it when $ vagrant plugin list

Vagrant version

Vagrant 2.4.1

Host operating system

# System Details Report
---

## Report details
- **Date generated:**                              2024-11-09 10:24:19

## Hardware Information:
- **Hardware Model:**                              Lenovo IdeaPad 3 15ALC6
- **Memory:**                                      8.0 GiB
- **Processor:**                                   AMD Ryzen™ 5 5500U with Radeon™ Graphics × 12
- **Graphics:**                                    AMD Radeon™ Graphics
- **Disk Capacity:**                               500.1 GB

## Software Information:
- **Firmware Version:**                            GLCN63WW
- **OS Name:**                                     Fedora Linux 41 (Workstation Edition)
- **OS Build:**                                    (null)
- **OS Type:**                                     64-bit
- **GNOME Version:**                               47
- **Windowing System:**                            Wayland
- **Kernel Version:**                              Linux 6.11.6-300.fc41.x86_64

Steps to reproduce

  1. vagrant plugin install vagrant-libvirt
pakosaan commented 1 week ago

I downgraded to version 2.4.0 and its woriking but hope it is fiexed soon

trinitronx commented 5 days ago

I should add that this issue will affect any OS due to the gem dependency conflict on excon.

What happened here is:

Therefore, get this error:

Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/specification.rb:2245:in `raise_if_conflicts': Unable to activate fog-core-2.6.0, because excon-0.112.0 conflicts with excon (~> 1.0)

So, while the plugins and their sub-dependencies are generally following the ideal case for specifying and bumping version constraints... due to Bundler & Ruby requiring sub-dependency gems to satisfy all the constraints, we end up with excon straddling the MAJOR version boundary. Thus, there's now a conflict between Vagrant's sub-dependencies and vagrant-libvirt plugin's sub-dependencies. Unless Bundler & Ruby allowed for isolated trees of leaf sub-dependencies to have different versions across an entire project stack, we need to match the versions being used across the plugin ecosystem.

In other words: Unless Bundler & Ruby adopt a sub-dependency isolation model (e.g. similar to NPM), Vagrant + plugins will need to match compatible version constraints for their dependencies across the ecosystem.

Further details explained here

Suggested Solution

What inside Vagrant depends on excon?

To figure this out, I installed the bundler-dependencies gem and ran the following:

$ git clone https://github.com/hashicorp/vagrant.git
$ rvm gemset create vagrant
$ rvm use ruby-3.1.2@vagrant
$ bundle install
$ gem install bundler-dependencies

$ bundle dependencies find excon
1 gems depend on excon:

vagrant
  * vagrant → vagrant_cloud → excon

So, the source of the dependency is vagrant_cloud pulling in excon.

EDIT: So, it looks like vagrant_cloud v3.1.2 has been released, now depending on excon ~> 1.0!

Now this just needs to bubble up into a Vagrant release and it should solve this issue! 🎉 👏

chrisroberts commented 5 days ago

Sorry for the delay on this. As noted above, the vagrant_cloud gem was published with updated dependency constraints to loosen them and the 2.4.3 version of Vagrant has been released which will pull in this new version.

Cheers!