Gem install or usage problem in shared environment

I am moving to a Westhost shared CPanel account and I am trying to set
up my environment for my application but there must be something I am
forgetting.

I am installing external gems and trying to use them. curl, xmlsimple
and fsdb

They install ok and ‘gem which gemname’ finds them, but ‘require’
gemname fails

[email protected] [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
[email protected] [~]# gem which curl
/home/gotgritc/ruby/gems/gems/curl-0.0.9/lib/curl.rb
[email protected] [~]# gem which fsdb
/home/gotgritc/ruby/gems/gems/fsdb-0.7.2/lib/fsdb.rb
[email protected] [~]# ruby -rubygems -e ‘require “xmlsimple.rb”’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require': no such file to load -- xmlsimple.rb (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from -e:1
[email protected] [~]# ruby -rubygems -e ‘require “xmlsimple”’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require': no such file to load -- xmlsimple (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from -e:1
[email protected] [~]# ruby -rubygems -e ‘require “curl”’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require': no such file to load -- curl (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from -e:1
[email protected] [~]# ruby -rubygems -e ‘require “curl.rb”’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require': no such file to load -- curl.rb (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from -e:1
[email protected] [~]#

my gem enviroment is:

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.24
  • RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
  • INSTALLATION DIRECTORY: /home/gotgritc/ruby/gems
  • RUBY EXECUTABLE: /usr/bin/ruby
  • EXECUTABLE DIRECTORY: /home/gotgritc/ruby/gems/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /home/gotgritc/ruby/gems
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
    • “gempath” => []
    • “gem” => “–remote --gen-rdoc --run-tests”
    • “gemhome” => “/home/gotgritc/ruby/gems”
    • “rdoc” => “–inline-source --line-numbers”
  • REMOTE SOURCES:

One of the gems is installed at

[email protected] [~/ruby]# find . -name xmlsimple.rb
./gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
[email protected] [~/ruby]#

is /home/gotgritc/ruby/gems/gems correct?

the first gems directory only has a gems subdirectory in it

it really bugs me that ‘gem which’ works but ‘require’ does not.
Could it be a problem with ‘custom_require’?

tom

The gem cmd you’re picking up is from a different ruby install.

Try ‘which ruby’ vs ‘which gem’.

I got a solution from WestHost and it may help others:

From what I am told you should be able to run the following to set your gem
directory.
export GEM_HOME=/home/gotgritc/ruby/gems

You should also be able to put it in your .bashrc file according to this:
http://docs.rubygems.org/read/chapter/3#page83

Tom

On Aug 6, 2012, at 11:50 , Tom M. [email protected] wrote:

I got a solution from WestHost and it may help others:

From what I am told you should be able to run the following to set your gem
directory.
export GEM_HOME=/home/gotgritc/ruby/gems

You should also be able to put it in your .bashrc file according to this:
http://docs.rubygems.org/read/chapter/3#page83

That’s not a solution for the problem you have. If you don’t fix it,
you’re going to get even more fucked up later on.

Ryan D. wrote in post #1071503:

On Aug 6, 2012, at 11:50 , Tom M. [email protected] wrote:

I got a solution from WestHost and it may help others:

From what I am told you should be able to run the following to set your gem
directory.
export GEM_HOME=/home/gotgritc/ruby/gems

You should also be able to put it in your .bashrc file according to this:
http://docs.rubygems.org/read/chapter/3#page83

That’s not a solution for the problem you have. If you don’t fix it,
you’re going to get even more messed up later on.

Ok, so what would you suggest?

Evidenced by the fact that I can now include files from locally
installed
gems, it surely seems to HELP.

What could it have broken?

Is there something you might suggest I try that may not work now?

Tom

On Aug 7, 2012, at 04:01 , Tom M. [email protected] wrote:

Ok, so what would you suggest?

Start by not ignoring my previous email:

Ryan,

It may be worth repeating that my gem environment is:

my gem enviroment is:

RubyGems Environment:

  • RUBYGEMS VERSION: 1.8.24
  • RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
  • INSTALLATION DIRECTORY: /home/gotgritc/ruby/gems
  • RUBY EXECUTABLE: /usr/bin/ruby
  • EXECUTABLE DIRECTORY: /home/gotgritc/ruby/gems/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /home/gotgritc/ruby/gems
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
    • “gempath” => []
    • “gem” => “–remote --gen-rdoc --run-tests”
    • “gemhome” => “/home/gotgritc/ruby/gems”
    • “rdoc” => “–inline-source --line-numbers”
  • REMOTE SOURCES:

You see that ‘gemhome’ is set properly, so maybe the shell environment
variable that I set it specific to WestHost (any maybe other shared
hosts)

Tom

Ryan D. wrote in post #1071595:

On Aug 7, 2012, at 04:01 , Tom M. [email protected] wrote:

Ok, so what would you suggest?

Start by not ignoring my previous email:

Ryan,

I am NOT ignoring your email.

And for a SECOND time I am asking for any other suggestion other than
DON’T DO THAT!

I do have a feeling your posts may have a very low signal to noise
ratio.

But seriously, do you have anything worth while to suggest to me?

Tom

James H.on wrote in post #1071601:

You’re running ruby 1.8 and requiring libraries without first using:

require “rubygems”

I did set RUBYOPT=rubygems in the environmant

Both the environment variable and the GEM_HOME variable are described in

http://docs.rubygems.org/read/chapter/3/

So what is so wrong doing it that way?

What harm could happen from this method?

tom

You’re running ruby 1.8 and requiring libraries without first using:

require “rubygems”

2012/8/8 Tom M. [email protected]:

So what is so wrong doing it that way?

What harm could happen from this method?

It is fine as long as you’re not trying to run multiple versions of
Ruby or Ruby installed via RVM. But when you do try it, you’re in for
a world of hurt.

– Matma R.

On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński
[email protected]wrote:

http://docs.rubygems.org/read/chapter/3/

Have you tried requiring rubygems first, to rule out the possibility of
that being the problem?

Bartosz Dziewoński wrote in post #1071604:

2012/8/8 Tom M. [email protected]:

So what is so wrong doing it that way?

What harm could happen from this method?

It is fine as long as you’re not trying to run multiple versions of
Ruby or Ruby installed via RVM. But when you do try it, you’re in for
a world of hurt.

– Matma R.

Well, that makes sense.

The good news is that there is only one SSH account and I am not
going to use it for development, so that sounds like I am safe…

Now that I know this, I can keep it in mind.

thanks,
tom

James H.on wrote in post #1071608:

On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński
[email protected]wrote:

http://docs.rubygems.org/read/chapter/3/

Have you tried requiring rubygems first, to rule out the possibility of
that being the problem?

Yes.

Isn’t RUBYOPT=rubygems aka ruby -rubygems the same thing?

If GEM_HOME is bad, I’ll be happy to try any other ideas.

I have a workable solution (within limits mentioned in another post)

Tom

Ryan D. wrote in post #1071615:

On Aug 7, 2012, at 16:28 , Tom M. [email protected] wrote:

And for a SECOND time I am asking for any other suggestion other than
DON’T DO THAT!

Where the hell did I say that? I suggested what I thought the problem
was and how to diagnose it.

Sorry I guess the email -> web interface must have dropped some emails

This is the thread as I saw it:

http://www.ruby-forum.com/topic/4404620

I see your points.

As I stated in the first post I am on a Westhost shared hosting account
so I do not have root access and they provide a local gems storage…

They are the same install and maybe the environment variable they
suggested is unique to them. (I am not sure if standard gems install
supports local installs with no root access when ruby/gems is installed
with root)

tom
ps. sorry I was a bit rude, I did not consider the email<->forum
interface had flaws

On Aug 7, 2012, at 16:28 , Tom M. [email protected] wrote:

And for a SECOND time I am asking for any other suggestion other than
DON’T DO THAT!

Where the hell did I say that? I suggested what I thought the problem
was and how to diagnose it.

I do have a feeling your posts may have a very low signal to noise
ratio.

But seriously, do you have anything worth while to suggest to me?

The suggestion I’ve made TWICE is worthwhile to anyone wanting to
diagnose their problem. It might not be worthwhile to you since you seem
to want to hear something completely different from what I’m saying.

You provided:

  • INSTALLATION DIRECTORY: /home/gotgritc/ruby/gems

and:

[email protected] [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb

and:

[email protected] [~]# ruby -rubygems -e ‘require “xmlsimple”’
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36

As you can see… “/usr/lib/ruby” != “/home/gotgritc/ruby/gems”

which means… AGAIN… that you’re most likely not running ‘gem’ and
‘ruby’ from the same install.

AGAIN to diagnose:

I had, I think, the identical problem.

I found that there was a .gemrc file in my home directory (don’t
remember how it got there) that specified values I didn’t want.

I guess .gemrc overrides the GEM_* environment variables?

I renamed .gemrc to something else and it works fine now.

  • Keith

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs