rvm gemset copy error - ruby

I'm working out the details to move from ruby-1.8.7 to ruby-1.9.2 with rvm and I'm hitting an issue with copying gems from one ruby to another and I wanted to see if anyone knew what the deal is and why it my be erring.
I already have 1.9.2 installed, but running rvm gemset copy is throwing an error.
[22:11][adamstacoviak:~]$ rvm gemset copy ruby-1.8.7-p249 ruby-1.9.2-p180
Copying gemset from ruby-1.8.7-p249 to ruby-1.9.2-p180
cp: cannot overwrite directory /Users/adamstacoviak/.rvm/gems/ruby-1.9.2-p180/cache with non-directory /Users/adamstacoviak/.rvm/gems/ruby-1.8.7-p249/cache
Making gemset for ruby-1.9.2-p180 pristine.
ERROR: Error running 'rvm gemset pristine' under ,
please read /Users/adamstacoviak/.rvm/log/ruby-1.8.7-p249/gemset.pristine.log
... and here's the contents of the log file. I did update bundler as well since I saw that it mentioned bundler-1.0.12 was not found. Updating to bundler 1.0.12 didn't do the trick.
[2011-04-12 22:09:54] rvm gemset pristine # under ruby-1.9.2-p180
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::RemoteFetcher
Restoring gem(s) to pristine condition...
Cached gem for bundler-1.0.12 not found, attempting to fetch...
[2011-04-12 22:14:26] rvm gemset pristine # under ruby-1.9.2-p180
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::RemoteFetcher
Restoring gem(s) to pristine condition...
Cached gem for bundler-1.0.12 not found, attempting to fetch...
Any thoughts on why rvm gemset copy is erring?

RVM is your friend and already knows how to upgrade your versions:
rvm help upgrade
Usage:
rvm upgrade [source ruby] [destination ruby]
Description:
Upgrades the specified (already installed) source ruby given to the
given destination ruby version. Will migrate gemsets, wrappers, aliases
and environment files.
The process will prompt you at each stage - if the versions look incorrect,
please cancel and perform it manually.
Examples:
$ rvm upgrade 1.9.2-p136 1.9.2-p180
$ rvm upgrade ree-2011.01 ree-2011-02
Type rvm help ugrade at the command line.

Simply add the line to the file
/usr/bin/gem (may be different on a
mac) require 'rubygems/gem_runner'
after require 'rubygems'
Found this over here

You could just use cp:
cp -R ~/.rvm/gems/ruby-1.8.7-p249/* ~/.rvm/gems/ruby-1.9.2-p180/

Related

How to make ruby gems available to all users?

I installed a Ruby gem running this command from root:
gem install pushmeup
The gem works well when executing scripts from root. When I try to execute a script from non-root user, I see this error about such gem not found:
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- pushmeup (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from pushAPNS.rb:2:in `<main>'
Edit:
RVM gives you compartmentalized independent ruby setups. This means
that ruby, gems and irb are all separate and self-contained - from the
system, and from each other.
https://rvm.io/gemsets/basics
============
Never use sudo with rvm.
Type rvm gemset list
Type rvm gemset use global
Type gem install some_gem
The gems in the global gemset will be available in all other gemsets. If you want to create a gemset for a specific project, then do:
rvm gemset create proj1_gems
rvm gemset list
rvm gemset use proj1_gems
To delete a gemset:
rvm gemset delete proj1_gems
rvm gemset list
Each version of ruby has its own gemsets. You can switch to a specific ruby version and one of the gemsets for that version with one command like this:
rvm use 2.0.0#proj1_gems
But generally, I do:
rvm use 2.0.0
rvm gemset list
rvm gemset use some_gemset_name_in_the_list

How do RVM rubies find gems?

I'm using Ruby 1.8.6 under RVM on Mac OS X (10.9.2). I installed everything as a local user (not root), and then installed a gem using:
gem install gli -v 1.6
When I run a ruby with require('gli'), I get the error:
in `require': no such file to load -- gli (LoadError)
even though gem list shows gli (1.6.0).
I don't know exactly how RVM does its gemsets, but there is no gli.rb file in any of the directories in the $LOAD_PATH.
How does RVM interact with the $LOAD_PATH to find the necessary gems in the gemset?
Try adding a require 'rubygems' at the top of your source file. In 1.8 rubygems aren't required by default.
Thus said, regarding gem paths:
GEM_HOME indicates where gems are installed. To find out what it is for your case do:
$ echo $GEM_HOME
This should display an RVM-related path, since RVM changes this environment variable in order to make the $ gem install command install gems in its directories.

How do you uninstall RVM gem?

Strange... but this is what I got :
$ gem list | grep rvm
>> rvm (1.11.3.3)
$ gem uninstall rvm
>> INFO: gem "rvm" is not installed
How can that be possible? The root of this problem probably stems from me downloading the latest RVM and finding that it does not work with the latest version of POW. Thus I had to implode RVM and reinstall an older version. Since then when I do a cap deploy, I get the classic :
`<top (required)>': RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)
Any ideas?
I recently encountered the same rvm error:
"RVM - Capistrano integration was extracted to a separate gem, install: gem install rvm-capistrano and remove the $LOAD_PATH.unshift line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)"
Doing what the error suggested did not work for me at all.
What did work for me was to do: rvm -v
When I did this I saw that my rvm version was rvm 1.13.0
Using "rvm get" I did "rvm get 1.12.0" but still got the error
Then I tried "rvm get 1.11.0" and then presto, my rvm started working again.
I'm not 100% sure what caused the error in the first place but I think it all began when I tried to upgrade rvm with rvm get stable after I was unable to install some gems. I found out that I wasn't able to install gems anymore due to the fact that I had updated my xcode to 4.3.2 and apparently Apple changed their c complier which doesn't play nice with rvm.
Hope this helps someone.
Are you in a gemset? If so, that gem might be in the interpreter's unnamed gemset or the global gemset. If so, try
rvm use 1.9.3
gem uninstall rvm
or
rvm use 1.9.3#global
gem uninstall rvm
I just ran into this error as well. The error you ran into was because of the recent capistrano update. If you add rvm-capistrano to your gemfile and remove the $LOAD-PATH.unshift line from your capistrano deployment file it should work, at least it did for me.
That would be correct. Its in the 'global' gemset. This gemset is 'mixed in' to both the 'default' gemset and any gemsets you actually create.
Thus if you have Ruby 1.9.3 installed, for example, (rvm install 1.9.3) it will be installed into that ruby's 'global'. You can verify this by doing 'gem list rvm -dl' which will show you the name, version, description, and location on the disk of the requested gem.
∴ gem list rvm -dl
*** LOCAL GEMS ***
rvm (1.11.3.3)
Authors: Wayne E. Seguin, Michal Papis
Homepage: https://rvm.beginrescueend.com/
Installed at: /home/me/.rvm/gems/ruby-1.9.3-p194#global
RVM Ruby Gem Library
∴
I don't know why you want it removed, but you would do as Abe stated as the second choice.
To give more details, RVM works with POW, this is known issue: https://github.com/37signals/pow/issues/271
the easiest solution(in project dir):
rvm env . > .powenv
The version of RVM might not be compatible with POW. You can remove RVM and then install the most current version.
The problem is that RVM 1.12 and up does not play well with Capistrano.
So uninstall your RVM, then get RVM 1.11 (rvm get 1.11.0).
Nathan got it right: https://stackoverflow.com/a/10306090/294449
You used to have to do the unshift in your deploy.rb but the latest versions of RVM have made that hack no longer necessary. Just remove it and add the rvm-capistrano gem to your Gemfile. It works like a charm.

How do I use RVM to create a gemset of three gems?

I want to play around with three similar Ruby gems called 'yahoofinance' 'yahoo-finance' and 'yahoo_stock'. I'm interested in how each gem works with Yahoo Finance. So I start with creating an rvm gemset,
[sandbox]$ rvm gemset create finance
'finance' gemset created (/Users/milktrader/.rvm/gems/ruby-1.9.2-p0#finance).
Then I use it,
[sandbox]$ rvm gemset use finance
Now using gemset 'finance'
Then I attached it to a ruby,
[sandbox]$ rvm 1.9.2-head#finance
Then I installed the three gems above,
[sandbox]$ gem install yahoo-finance yahoofinance yahoo_stock
Successfully installed yahoo-finance-0.0.2
Successfully installed yahoofinance-1.2.2
Successfully installed yahoo_stock-1.0.2
3 gems installed
.
.
.
Installing RDoc documentation for yahoo_stock-1.0.2...
Now I'm incorrectly assuming I can require all three gems in an irb sesssion. Only one of them returns true.
ruby-1.9.2-head > require 'yahoofinance'
=> true
While the other two throw errors.
ruby-1.9.2-head > require 'yahoo-finance'
LoadError: no such file to load -- yahoo-finance
ruby-1.9.2-head > require 'yahoo_stock'
SyntaxError: ...
Is there a problem with the gems or my installation?
NOTE: I am foggy about the rvm gemset use command, and it's probably not being used correctly above.
[sandbox]$ gem list
*** LOCAL GEMS ***
bundler (1.0.7)
rake (0.8.7)
yahoo-finance (0.0.2)
yahoo_stock (1.0.2)
yahoofinance (1.2.2)
I initially hit the same errors you did, so it's not environment.
The issue with yahoo-finance is that it must be required as yahoo_finance.
The issue with yahoo_stock is a syntax error, indicating that the file is being loaded, but not interpreted correctly. Upon inspecting the Github project's changelog, we see that this syntax error in history.rb for Ruby 1.9.1 was fixed in version 1.0.5, but the version in the central gem repository is 1.0.2. Turns out that the gem's owner now calls the gem nas-yahoo_stock, so running gem install nas-yahoo_stock should resolve that issue.

Install Rails 3 on OSX with RVM

Trying to install the new Rails 3 release on OSX 10.6.
Have never touched Ruby or Rails on this machine since purchased.
I was able to get rvm and get Ruby 1.9.2. installed. From there, I am stuck.
I tried:
rvmsudo gem install rails -v 3.0.0
sudo gem install rails --pre
sudo gem install rails
sudo gem update rails
And I get the same result error each time:
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-head#rails3/cache/activesupport-3.0.0.gem
If I do gem list, it says LOCAL GEMS and doesn't list anything.
I have read a few walkthroughs but honestly none of them address this issue and its kind of pissing me off. Why is this so difficult to install? Would love to learn it if someone could help me get it running.
I was trying to follow this:
http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm
and this:
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard
Which is actually linked from the ROR guides website. Am I missing dependencies? How do I get them in?
If I do rails -v I get:
rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18
Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.
What I had to do this morning:
rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update
You don't need to use sudo when installing gems with rvm. If you follow the directions here to get RVM installed, you should be able to just do rvm use 1.9.2; gem install rails --version 3.0.0.
You don't have to specify version 3. If you have 1.9.2-p0, it will automatically get rails 3 when you rvm gem install rails 3. note: no sudo. I think when you use sudo it makes it use the system-installed ruby. If you think you need sudo, use rvmsudo.
Things probably got messy because you were following guides based on the pre-stable release of rails, which involved many other things. If you like, you can try uninstalling rvm and re-doing everything. It really isn't all that difficult.
Remember, you need 1.9.2, 1.9.1 won't work.
curl -O http://rvm.beginrescueend.com/releases/rvm-install-head
sh rvm-install-head
rvm install 1.9.2-p0
# also remember to edit your bash profile and add the required lines
# verify that 1.9.2-p0 shows up there
rvm list
# makes it so you're using it, and sets it as the default
rvm use 1.9.2-p0 --default
# verify this happened. should have => 1.9.2-p0 in the list
rvm list
# verify the version
ruby --version
# should automatically get 3.0
# `rvm gem install` installs it for every single installed ruby version
# in my experience
gem install rails
When you did rvm gem install, I think it installs it for every ruby version you have registered with rvm (at least it happened in my experience), so my assumption is that it was trying to force install rails 3 for an older ruby installation, which was missing the required gems.
Take it easy, not many commands are required. If you find yourself having to do 'hacks' or workarounds, then you're doing it wrong. Thankfully it's easy to start over. To remove rvm, just do rm -rfv ~/.rvm and also rm ~/.rvmrc if it's there.
Let me know how it goes.
working through this myself as new user mac osx blah blah
seems like a cache directory doesn't get made, try
mkdir $HOME/.rvm/gems/cache
so far so good after that...
I am running into the same problem (tried uninstalling and installing like Blaenk suggested)
rvm -v
rvm 1.0.2 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]
ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
gem install rails
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - /Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem
After doing "rvm update && rvm reload" rvm got updated to 1.04 (instead of 1.02 which I got via the recommended GIT install yesterday!?) it worked nicely.
The solution worked for me, with a few tweeks:
Instead of using rvm update, I had to use rvm rubygems. Then, after doing all the work from post 2, I had to execute bundle install and I entered rvm use 1.9.2#rails3 to my .rvmrc file. Everything now works like a charm, even when starting a new shell or terminal session. The full list of commands I used is:
>> NEW >> rvm rubygems
rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
>> DID NOT NEED >> hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
>> NEW >> bundle install
>> NEW >> cat 'rvm use 1.9.2#rails3' > .rvmrc
Followed these instructions, and found them very useful for rvm installation. Hope they work for you.
http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/
Doing this after the rvm update and reload worked for me:
rm -rf .bundle && bundle install

Resources