Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two default versions of rake installed - how to delete one #2157

Closed
1 task done
Constantin07 opened this issue Jan 24, 2018 · 9 comments
Closed
1 task done

Two default versions of rake installed - how to delete one #2157

Constantin07 opened this issue Jan 24, 2018 · 9 comments

Comments

@Constantin07
Copy link

Hello,

I cannot get rid of one of rake versions on my Ubuntu 16.04.3 LTS box

This issue is related to:

  • Installing a library

Here are my current environment details:

$ gem env version
2.6.14
# ./gem list rake

*** LOCAL GEMS ***

rake (default: 12.1.0, default: 10.4.2)
/gem list rake -d

*** LOCAL GEMS ***

rake (12.1.0, 10.4.2)
    Authors: Hiroshi SHIBATA, Eric Hodel, Jim Weirich
    Homepage: https://github.com/ruby/rake
    License: MIT
    Installed at (12.1.0, default): /opt/****/ruby/gems/2.2.0
                 (10.4.2, default): /opt/****/ruby/gems/2.2.0
./gem uninstall rake -v 12.1.0
ERROR:  While executing gem ... (Gem::InstallError)
    gem "rake" cannot be uninstalled because it is a default gem

How does it come that it allows 2 default rake versions ?
Please advice how to delete one of them so just to leave one ...

@Constantin07 Constantin07 changed the title 2 default versions of rake installed - how to delete one Two default versions of rake installed - how to delete one Jan 24, 2018
@colby-swandale
Copy link
Member

What's the output of gem env?

@Constantin07
Copy link
Author

# ./gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.14
  - RUBY VERSION: 2.2.8 (2017-09-14 patchlevel 477) [x86_64-linux]
  - INSTALLATION DIRECTORY: /opt/****/embedded/lib/ruby/gems/2.2.0
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.2.0
  - RUBY EXECUTABLE: /opt/****/embedded/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/****/embedded/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /opt/****/embedded/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /opt/****/embedded/lib/ruby/gems/2.2.0
     - /root/.gem/ruby/2.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /snap/bin

@segiddins
Copy link
Member

My guess is that there's actually only one default rake installed, but 2 gemspecs. What's the output of ls /opt/****/embedded/lib/ruby/gems/2.2.0/specifications/default ?

@znz
Copy link
Contributor

znz commented Jan 30, 2018

When install ruby with new default gems to same path without uninstalling old ruby, it may cause duplicated default gems.
ref https://bugs.ruby-lang.org/issues/12764

But ruby 2.2.x bundles rake 10.4.2 only.
I wonder where rake 12.1.0 from.

@Constantin07
Copy link
Author

@segiddins here is output:

bigdecimal-1.2.6.gemspec
io-console-0.4.3.gemspec
json-1.8.1.1.gemspec
psych-2.0.8.1.gemspec
rake-10.4.2.gemspec
rake-12.1.0.gemspec
rdoc-4.2.0.gemspec

@hsbt
Copy link
Member

hsbt commented Jan 31, 2018

If you invoke gem install rake --default, rubygems do install rake-12.1.0 as default gems.

You can remove it manually like rm /opt/****/embedded/lib/ruby/gems/2.2.0/specifications/default/rake-12.1.0.gemspec

@colby-swandale
Copy link
Member

ping @Constantin07

@Constantin07
Copy link
Author

@hsbt Thanks a lot!
Running below solved the problem.

rm /opt/****/embedded/lib/ruby/gems/2.2.0/specifications/default/rake-12.1.0.gemspec

./gem list rake

*** LOCAL GEMS ***

rake (default: 12.1.0)

@rquant
Copy link

rquant commented Mar 22, 2022

Thanks this was very helpful. I had a similar issue trying to update bundler gem from 2.1.4 to 2.3.9.

Running gem info bundler I can see there are multiple defaults.

 gem info bundler

*** LOCAL GEMS ***

bundler (2.3.9, 2.1.4)
    Authors: André Arko, Samuel Giddins, Colby Swandale, Hiroshi
    Shibata, David Rodríguez, Grey Baker, Stephanie Morillo, Chris
    Morris, James Wen, Tim Moore, André Medeiros, Jessica Lynn Suttles,
    Terence Lee, Carl Lerche, Yehuda Katz
    Homepage: https://bundler.io
    License: MIT
    Installed at (2.3.9, default): /Users/ryan.quant/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0
                 (2.1.4, default): /Users/ryan.quant/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0

    The best way to manage your application's dependencies

The above solution worked for me, but required one additional step (I use rbenv as my ruby manager):

rm /Users/ryan.quant/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/specifications/default/bundler-2.1.4.gemspec

gem install bundler:2.3.9

I had to reinstall new version after removing the gemspec for the outdated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants