Tom Moulton | 4 Aug 2012 21:19

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 <at> xyz.us [~/]# gem which xmlsimple
/home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
gotgritc <at> xyz.us [~]# gem which curl
/home/gotgritc/ruby/gems/gems/curl-0.0.9/lib/curl.rb
gotgritc <at> xyz.us [~]# gem which fsdb
/home/gotgritc/ruby/gems/gems/fsdb-0.7.2/lib/fsdb.rb
gotgritc <at> 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 <at> 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 <at> xyz.us [~]# ruby -rubygems -e 'require "curl"'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
(Continue reading)

Ryan Davis | 5 Aug 2012 12:00
Gravatar

Re: Gem install or usage problem in shared environment

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 <at> 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 <at> xyz.us [~/]# gem which xmlsimple
> /home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb
> gotgritc <at> xyz.us [~]# gem which curl
> /home/gotgritc/ruby/gems/gems/curl-0.0.9/lib/curl.rb
> gotgritc <at> xyz.us [~]# gem which fsdb
> /home/gotgritc/ruby/gems/gems/fsdb-0.7.2/lib/fsdb.rb
> gotgritc <at> 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 <at> xyz.us [~]# ruby -rubygems -e 'require "xmlsimple"'
> /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
(Continue reading)

Tom Moulton | 6 Aug 2012 20:50

Re: Gem install or usage problem in shared environment

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 Davis | 7 Aug 2012 06:30
Gravatar

Re: Gem install or usage problem in shared environment


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

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.

Tom Moulton | 7 Aug 2012 13:01

Re: Gem install or usage problem in shared environment

Ryan Davis wrote in post #1071503:
> On Aug 6, 2012, at 11:50 , Tom Moulton <lists <at> 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
>
> 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

--

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

(Continue reading)

Ryan Davis | 7 Aug 2012 23:50
Gravatar

Re: Gem install or usage problem in shared environment


On Aug 7, 2012, at 04:01 , Tom Moulton <lists <at> 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'.

James Harrison | 8 Aug 2012 00:59
Favicon
Gravatar

Re: Gem install or usage problem in shared environment

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 <at> zenspider.com> wrote:

On Aug 7, 2012, at 04:01 , Tom Moulton <lists <at> 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'.



Tom Moulton | 8 Aug 2012 01:36

Re: Gem install or usage problem in shared environment

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/.

Bartosz Dziewoński | 8 Aug 2012 01:50
Picon

Re: Gem install or usage problem in shared environment

2012/8/8 Tom Moulton <lists <at> 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

James Harrison | 8 Aug 2012 03:07
Favicon
Gravatar

Re: Gem install or usage problem in shared environment



On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński <matma.rex <at> gmail.com> wrote:
2012/8/8 Tom Moulton <lists <at> 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


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

Tom Moulton | 8 Aug 2012 03:22

Re: Gem install or usage problem in shared environment

James Harrison wrote in post #1071608:
> On Tue, Aug 7, 2012 at 5:50 PM, Bartosz Dziewoński
> <matma.rex <at> 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/.

Tom Moulton | 8 Aug 2012 03:16

Re: Gem install or usage problem in shared environment

Bartosz Dziewoński wrote in post #1071604:
> 2012/8/8 Tom Moulton <lists <at> 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/.

Tom Moulton | 8 Aug 2012 01:28

Re: Gem install or usage problem in shared environment

Ryan Davis wrote in post #1071595:
> On Aug 7, 2012, at 04:01 , Tom Moulton <lists <at> ruby-forum.com> 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

--

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

Ryan Davis | 8 Aug 2012 04:36
Gravatar

Re: Gem install or usage problem in shared environment


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

> Ryan Davis wrote in post #1071595:
>> On Aug 7, 2012, at 04:01 , Tom Moulton <lists <at> ruby-forum.com> 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!

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 <at> xyz.us [~/]# gem which xmlsimple
> /home/gotgritc/ruby/gems/gems/xml-simple-1.1.1/lib/xmlsimple.rb

and:

> gotgritc <at> 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:

> 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.

Tom Moulton | 8 Aug 2012 05:06

Re: Gem install or usage problem in shared environment

Ryan Davis wrote in post #1071615:
> On Aug 7, 2012, at 16:28 , Tom Moulton <lists <at> ruby-forum.com> 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

--

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

Tom Moulton | 7 Aug 2012 14:32

Re: Gem install or usage problem in shared environment

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/.

Keith B. | 21 Sep 2012 19:29

Re: Gem install or usage problem in shared environment

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/.


Gmane