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

gotgritc@xyz.us [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
gotgritc@xyz.us [~]# gem which curl
/home/gotgritc/ruby/gems/gems/curl-0.0.9/lib/curl.rb
gotgritc@xyz.us [~]# gem which fsdb
/home/gotgritc/ruby/gems/gems/fsdb-0.7.2/lib/fsdb.rb
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]#

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:
     - http://rubygems.org/

···

-----------

One of the gems is installed at

gotgritc@xyz.us [~/ruby]# find . -name xmlsimple.rb
./gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
gotgritc@xyz.us [~/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

--
Posted via http://www.ruby-forum.com/.

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

Try 'which ruby' vs 'which gem'.

···

On Aug 4, 2012, at 12:19, Tom Moulton <lists@ruby-forum.com> wrote:

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

gotgritc@xyz.us [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
gotgritc@xyz.us [~]# gem which curl
/home/gotgritc/ruby/gems/gems/curl-0.0.9/lib/curl.rb
gotgritc@xyz.us [~]# gem which fsdb
/home/gotgritc/ruby/gems/gems/fsdb-0.7.2/lib/fsdb.rb
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]# 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:in
`require'
from -e:1
gotgritc@xyz.us [~]#

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:
    - http://rubygems.org/

-----------

One of the gems is installed at

gotgritc@xyz.us [~/ruby]# find . -name xmlsimple.rb
./gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
gotgritc@xyz.us [~/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

--
Posted via http://www.ruby-forum.com/\.

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

···

--
Posted via http://www.ruby-forum.com/\.

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:
     - http://rubygems.org/

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

···

--
Posted via http://www.ruby-forum.com/.

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

···

--
Posted via http://www.ruby-forum.com/.

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.

···

On Aug 6, 2012, at 11:50 , Tom Moulton <lists@ruby-forum.com> 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

Ryan Davis wrote in post #1071503:

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 6, 2012, at 11:50 , Tom Moulton <lists@ruby-forum.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

Ok, so what would you suggest?

Start by not ignoring my previous email:

···

On Aug 7, 2012, at 04:01 , Tom Moulton <lists@ruby-forum.com> wrote:

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

Try 'which ruby' vs 'which gem'.

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

require "rubygems"

···

On Tue, Aug 7, 2012 at 3:50 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Aug 7, 2012, at 04:01 , Tom Moulton <lists@ruby-forum.com> wrote:

> Ok, so what would you suggest?

Start by not ignoring my previous email:

> The gem cmd you're picking up is from a different ruby install.
>
> Try 'which ruby' vs 'which gem'.

Ryan Davis wrote in post #1071595:

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

···

On Aug 7, 2012, at 04:01 , Tom Moulton <lists@ruby-forum.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

James Harrison 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

···

--
Posted via http://www.ruby-forum.com/\.

Ryan Davis wrote in post #1071595:

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!

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:

gotgritc@xyz.us [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb

and:

gotgritc@xyz.us [~]# 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:

···

On Aug 7, 2012, at 16:28 , Tom Moulton <lists@ruby-forum.com> wrote:

On Aug 7, 2012, at 04:01 , Tom Moulton <lists@ruby-forum.com> wrote:

Try 'which ruby' vs 'which gem'.

--
I know that you believe you understand what you think I said but,
I'm not sure you realize that what you heard is not what I meant.

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 Rex

···

2012/8/8 Tom Moulton <lists@ruby-forum.com>:

James Harrison 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?

Ryan Davis wrote in post #1071615:

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:

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 Moulton <lists@ruby-forum.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

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

···

On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński <matma.rex@gmail.com>wrote:

2012/8/8 Tom Moulton <lists@ruby-forum.com>:
> James Harrison 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?

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 Rex

Bartosz Dziewoński wrote in post #1071604:

···

2012/8/8 Tom Moulton <lists@ruby-forum.com>:

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 Rex

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

--
Posted via http://www.ruby-forum.com/\.

James Harrison wrote in post #1071608:

···

On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński > <matma.rex@gmail.com>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

--
Posted via http://www.ruby-forum.com/\.