# LoadError - Mechanize, Hpricot (gems)

**URL:** <https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085>\
**Category:** Ruby\
**Created:** [August 15, 2007, 4:26am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085 "2007-08-15T04:26:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2007, 4:26am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/1 "2007-08-15T04:26:30Z")

</div>

Hello,

I’ve been trying to install and use Mechanize (  
[http://rubyforge.org/projects/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](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 ?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2007, 11:37am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/2 "2007-08-15T11:37:05Z")

</div>

removed\_email\_address@domain.invalid 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?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 15, 2007, 12:27pm UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/3 "2007-08-15T12:27:11Z")

</div>

> 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](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\>

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 16, 2007, 1:41am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/4 "2007-08-16T01:41:08Z")

</div>

On 8 16 , 7:28, Stefan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 ?

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 16, 2007, 1:46am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/5 "2007-08-16T01:46:08Z")

</div>

On 8 16 , 7:28, Stefan M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 16, 2007, 12:30am UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/6 "2007-08-16T00:30:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [August 16, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/loaderror-mechanize-hpricot-gems/112085/7 "2007-08-16T22:50:16Z")

</div>

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/](http://tattle.rubygarden.org/)
