# Unpacked wrong version of gem, can't get back

**URL:** <https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674>\
**Category:** Rails\
**Created:** [March 24, 2010, 3:10pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674 "2010-03-24T15:10:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 24, 2010, 3:10pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674/1 "2010-03-24T15:10:05Z")

</div>

Hey all

I got myself into a bit of a corner. I unpacked hpricot 0.8.2 into my  
vendor/gems folder then realised that i needed to unpack 0.8.1 instead.  
No problem, i thought, i’ll just delete that folder out of gems, change  
the config.gem specification in environment.rb, and do it again. But  
now i get this error whenever i try to do anything with rake:

rake aborted!  
can’t activate , already activated hpricot-0.8.2

I tried commenting out the line in environment.rb, which is

config.gem “hpricot”, :version =\> ‘0.8.1’

and doing

rake gems:refresh\_specs

This worked insofar as i was able to run rake without generating the  
error, but then when i uncomment the line, and try to unpack hpricot  
0.8.1 then i get the error again.

Can anyone set me straight on this? Presumably somewhere other than  
vendor/gems ‘knows’ which gems are unpacked? Where is this info held?

Grateful for any advice - max

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 24, 2010, 3:48pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674/2 "2010-03-24T15:48:29Z")

</div>

I managed to solve this by uninstalling version 0.8.2 of the hpricot  
gem. Which has confused me even more … does my gems folder know  
what’s going on in my rails app??? buh?

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 24, 2010, 4:10pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674/3 "2010-03-24T16:10:32Z")

</div>

On Mar 24, 2010, at 10:48 AM, Max W. wrote:

> I managed to solve this by uninstalling version 0.8.2 of the hpricot  
> gem. Which has confused me even more … does my gems folder know  
> what’s going on in my rails app??? buh?

No, but rubygems “knows” that you want the highest available version  
when it encounters:

require ‘hpricot’

You might have been requiring it somewhere earlier than Rails  
processed the config.gem that limited (specified) the version that you  
wanted.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 24, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674/4 "2010-03-24T16:27:24Z")

</div>

Hi Rob - my first statement in that last post was actually a lie - haml  
(which i have in my plugins) requires hpricot, that must be the source  
of the first problem. I’d still like to know why it’s complaining about  
me needing to build the gem though.

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 24, 2010, 4:20pm UTC](https://www.ruby-forum.com/t/unpacked-wrong-version-of-gem-cant-get-back/185674/5 "2010-03-24T16:20:57Z")

</div>

Rob B. wrote:

> You might have been requiring it somewhere earlier than Rails  
> processed the config.gem that limited (specified) the version that you  
> wanted.

ah - in one of the other frozen gems or plugins you mean? I did a  
search of my application and the only reference i could find to hpricot  
was the line in my config/environment.rb:

config.gem “hpricot”, :version =\> ‘0.8.1’

As it happens i still didn’t fix it as, after uninstalling 0.8.2, i was  
able to unpack 0.8.1 into vendor/gems, but now i can’t start mongrel or  
rake: i get this error:

The following gems have native components that need to be built  
hpricot = 0.8.1

You’re running:  
ruby 1.8.6.111 at /usr/bin/ruby1.8  
rubygems 1.3.5 at ,  
/home/max/work/akrotoski\_container/akrotoski/thoth,  
/home/max/.gem/ruby/1.8, /var/lib/gems/1.8

Run `rake gems:build` to build the unbuilt gems.

And of course, i can’t do `rake gems:build` to build the unbuilt gems,  
because rake blows up with this error on starting!

I think i’m missing some fundamental knowledge about what is actually  
going on here.
