LoadError - Mechanize, Hpricot (gems)

Hello,

I’ve been trying to install and use Mechanize (
http://rubyforge.org/projects/mechanize/
), and cannot solve the errors that occur.

Actually, I’m not sure the error is really linked to this gem, because
I remember having had the same kind of problems while trying to
install other gems.

So, I’m working on windows, with cygwin.

I installed Mechanize with the following command line :

gem install mechanize

and it seems to have installed successfully :

Successfully installed mechanize-0.6.10
Installing ri documentation for mechanize-0.6.10…
Installing RDoc documentation for mechanize-0.6.10…

So, after this, I try to use it, as written on this page :

http://mechanize.rubyforge.org/mechanize/files/EXAMPLES_txt.html

And here’s what happens :

irb(main):001:0> require “rubygems”
=> true
irb(main):002:0> require “mechanize”
LoadError: Permission denied - /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-
mswin32/lib/i686-linux/hpricot_scan.so
from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/i686-
linux/hpricot_scan.so
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/ hpricot.rb:20 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize/page.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize.rb:40 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in `require’
from (irb):2
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:279

Then, I just go where the hpricot_scan.so file is, “chmod +x” it, and
retry. Then :

irb(main):003:0> require “mechanize”
LoadError: No such file or directory - /usr/lib/ruby/gems/1.8/gems/
hpricot-0.6-mswin32/lib/i686-linux/hpricot_scan.so
from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/i686-
linux/hpricot_scan.so
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/ hpricot.rb:20 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize/page.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize.rb:40 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in `require’
from (irb):3
from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:279

Anyway, the file really does exists.

Is there anyone who know how to solve this problem please ?

[email protected] wrote:

irb(main):001:0> require “rubygems”
=> true
irb(main):002:0> require “mechanize”
LoadError: Permission denied - /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-
mswin32/lib/i686-linux/hpricot_scan.so

Is Hpricot installed?

Is Hpricot installed?

Yes it is.

Another attempt, on another machine :

[Guillaume@KILLY971 ~]$ gem install mechanize
Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency hpricot? [Yn] Y
Select which gem to install for your platform (i386-cygwin)

  1. hpricot 0.6 (mswin32)
  2. hpricot 0.6 (jruby)
  3. hpricot 0.6 (ruby)
  4. hpricot 0.5 (ruby)
  5. hpricot 0.5 (mswin32)
  6. Skip this gem
  7. Cancel installation

1
Install required dependency hoe? [Yn] Y
Install required dependency rubyforge? [Yn] Y
Successfully installed mechanize-0.6.10
Successfully installed hpricot-0.6-mswin32
Successfully installed hoe-1.3.0
Successfully installed rubyforge-0.4.4
Installing ri documentation for mechanize-0.6.10…
Installing ri documentation for hpricot-0.6-mswin32…
Installing ri documentation for hoe-1.3.0…
Installing ri documentation for rubyforge-0.4.4…
Installing RDoc documentation for mechanize-0.6.10…
Installing RDoc documentation for hpricot-0.6-mswin32…
Installing RDoc documentation for hoe-1.3.0…
Installing RDoc documentation for rubyforge-0.4.4…
[Guillaume@KILLY971 ~]$ irb
irb(main):001:0> require “rubygems”
=> true
irb(main):002:0> require “mechanize”
LoadError: Permission denied - /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-
mswin32/lib/i686-linux/hpricot_scan.so
from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/i686-
linux/hpricot_scan.so
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/hpricot-0.6-mswin32/lib/ hpricot.rb:20 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize/page.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in require' from /usr/lib/ruby/gems/1.8/gems/mechanize-0.6.10/lib/ mechanize.rb:40 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 32:in gem_original_require’
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in `require’
from (irb):2
irb(main):003:0>

On 8 16 , 7:28, Stefan M. [email protected] wrote:

Select which gem to install for your platform (i386-cygwin)

Stefan

I didn’t know, until know it seemed to work when I was using mswin32
to install other gems…
I am going to try. By the way, what is the difference between these 2
installs ?

On 8 16 , 7:28, Stefan M. [email protected] wrote:

Select which gem to install for your platform (i386-cygwin)

Stefan

Thank you very much !
I tryed to install like you said, with the 3 option, and now it works
perfectly.

killy971 wrote:

  1. hpricot 0.6 (mswin32)
  2. hpricot 0.6 (jruby)
  3. hpricot 0.6 (ruby)
  4. hpricot 0.5 (ruby)
  5. hpricot 0.5 (mswin32)
  6. Skip this gem
  7. Cancel installation

1

Shouldn’t you use ruby (3) for a cygwin install?

Stefan

killy971 wrote:

  1. Cancel installation

1
Shouldn’t you use ruby (3) for a cygwin install?

I didn’t know, until know it seemed to work when I was using mswin32
to install other gems…
I am going to try. By the way, what is the difference between these 2
installs ?

I’m not 100% sure about the facts or the wording, so take this with a
grain of salt:

Cygwin provides an environment where posix-compliant programs can
compile and run. This means that any library used by this program must
be compiled for cygwin as well.

Windows users (at least those I know) do not have a compiler installed
so most gem-authors provide a gem with compiled libraries that fit to a
windows-ruby.

If you select the mswin32-gem the precompiled libraries get installed,
which are not compatible to cygwin.

So, if on cygwin - always select ruby-versions of gem.

Some time ago I had problems with a parallel install of a windows-ruby
(via one-click-installer) and the cygwin one - something to do with
environment variables. So be careful when mixing.

Stefan

P.S.: There was a poll (via gem) some time ago about which platforms
ruby is used on - http://tattle.rubygarden.org/