Problem with activesupport version

Hi,

I’m fairly new to rails development and am using Ubuntu 9.04 as my distribution. I’m trying to get the ‘authlogic_example’ sample app working, however I run into this problem when I try to install the gems neccessary.

$ sudo rake gems:install (in /home/srdan/rails/authlogic_example) rake aborted! can’t activate activesupport (>= 0, runtime), already activated activesupport-2.1.0

(See full trace by running task with --trace)

The output of ‘gem list’ shows that I do in fact have activesupport installed, version 2.3.4

$ sudo gem list

*** LOCAL GEMS ***

actionmailer (2.3.4) actionpack (2.3.4) activerecord (2.3.4)

activeresource (2.3.4) activesupport (2.3.4) authlogic (2.1.3) mysql (2.8.1) nifty-generators (0.3.0) rack (1.0.1) rails (2.3.4) rake (0.8.7) rubygems-update (1.3.5) sqlite3-ruby (1.2.5)

What exactly is causing the problem here? Is it that authlogic requires an older version of activesupport or is it something else? Should I uninstall the newer version of activesupport and replace it with the older version? If so, how would I do that?

Thank you

Can you post the result of running the task with --trace, as recommended by the error? Also, check to see if you have any other versions of Ruby installed, as the error implies that ActiveSupport 2.1.0 is being loaded from *someplace*, but it's not shown in the output of 'gem list'.

--Matt Jones

Hi,

The output with the --trace commmand is as follows:

srdan@srdan-laptop:~/rails/authlogic_example$ sudo rake --trace gems:install (in /home/srdan/rails/authlogic_example)

** Invoke gems:install (first_time) ** Invoke gems:base (first_time) ** Execute gems:base ** Invoke environment (first_time) ** Execute environment rake aborted! can’t activate activesupport (>= 0, runtime), already activated activesupport-2.1.0

/usr/lib/ruby/1.8/rubygems.rb:149:in activate' /usr/lib/ruby/1.8/rubygems.rb:165:in activate’ /usr/lib/ruby/1.8/rubygems.rb:164:in each' /usr/lib/ruby/1.8/rubygems.rb:164:in activate’ /usr/lib/ruby/1.8/rubygems.rb:49:in `gem’

/home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/rails/gem_dependency.rb:32:in add_load_paths' /home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/inflector.rb:283:in to_proc’

/home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/initializer.rb:241:in each' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:241:in add_gem_load_paths’

/home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/initializer.rb:115:in process' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:93:in send’ /home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/initializer.rb:93:in `run’

/home/srdan/rails/authlogic_example/config/environment.rb:13 /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require’ /home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require’

/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in new_constants_in' /home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in require’

/home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/misc.rake:3 /usr/lib/ruby/1.8/rake.rb:546:in call' /usr/lib/ruby/1.8/rake.rb:546:in execute’ /usr/lib/ruby/1.8/rake.rb:541:in `each’

/usr/lib/ruby/1.8/rake.rb:541:in execute' /usr/lib/ruby/1.8/rake.rb:508:in invoke_with_call_chain’ /usr/lib/ruby/1.8/rake.rb:501:in synchronize' /usr/lib/ruby/1.8/rake.rb:501:in invoke_with_call_chain’

/usr/lib/ruby/1.8/rake.rb:494:in invoke' /home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/gems.rake:15 /usr/lib/ruby/1.8/rake.rb:546:in call’ /usr/lib/ruby/1.8/rake.rb:546:in `execute’

/usr/lib/ruby/1.8/rake.rb:541:in each' /usr/lib/ruby/1.8/rake.rb:541:in execute’ /usr/lib/ruby/1.8/rake.rb:508:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:501:in synchronize’ /usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain’

/usr/lib/ruby/1.8/rake.rb:518:in invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:1183:in each’ /usr/lib/ruby/1.8/rake.rb:1183:in send' /usr/lib/ruby/1.8/rake.rb:1183:in each’ /usr/lib/ruby/1.8/rake.rb:515:in `invoke_prerequisites’

/usr/lib/ruby/1.8/rake.rb:507:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:501:in synchronize’ /usr/lib/ruby/1.8/rake.rb:501:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:494:in invoke’

/usr/lib/ruby/1.8/rake.rb:1931:in invoke_task' /usr/lib/ruby/1.8/rake.rb:1909:in top_level’ /usr/lib/ruby/1.8/rake.rb:1909:in each' /usr/lib/ruby/1.8/rake.rb:1909:in top_level’ /usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling’

/usr/lib/ruby/1.8/rake.rb:1903:in top_level' /usr/lib/ruby/1.8/rake.rb:1881:in run’ /usr/lib/ruby/1.8/rake.rb:1948:in standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1878:in run’ /usr/bin/rake:28

Also, the version of ruby that I’m running is 1.8.7:

$ ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

From the trace command it seems that authlogic is not finding the correct version of active support.

Thanks

Why is Rails 2.1.0 frozen in /home/srdan/rails/authlogic_example/ vendor/rails? That's what's causing the problem. The error is caused by authlogic specifying a dependency on activesupport, which wasn't properly stubbed in the gem index back in 2.1.0 (see #1107 Vendor'd rails gems can't be "depended" - Ruby on Rails - rails for more details).

--Matt Jones

Hi,

From the link that you sent, the fix seems to be to add the line:

Gem.source_index.add_spec(Gem.loaded_specs[stub])

To ‘initializer.rb’. I’ve tried adding this line to ‘/var/lib/gems/1.8/gems/rails-2.3.4/lib/initializer.rb’.

Adding it to the file gave the following error:

$ rake gems:install --trace (in /home/srdan/rails/authlogic_example) ** Invoke gems:install (first_time) ** Invoke gems:base (first_time) ** Execute gems:base

** Invoke environment (first_time) ** Execute environment rake aborted! can’t activate activesupport (>= 0, runtime), already activated activesupport-2.1.0 /usr/lib/ruby/1.8/rubygems.rb:149:in `activate’

/usr/lib/ruby/1.8/rubygems.rb:165:in activate' /usr/lib/ruby/1.8/rubygems.rb:164:in each’ /usr/lib/ruby/1.8/rubygems.rb:164:in activate' /usr/lib/ruby/1.8/rubygems.rb:49:in gem’ /home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/rails/gem_dependency.rb:32:in `add_load_paths’

/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/inflector.rb:283:in to_proc' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:242:in each’

/home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/initializer.rb:242:in add_gem_load_paths' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:115:in process’

/home/srdan/rails/authlogic_example/config/…/vendor/rails/railties/lib/initializer.rb:93:in send' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:93:in run’ /home/srdan/rails/authlogic_example/config/environment.rb:13

/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in require’ /home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require’

/home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in new_constants_in' /home/srdan/rails/authlogic_example/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in require’

/home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/misc.rake:3 /usr/lib/ruby/1.8/rake.rb:546:in call' /usr/lib/ruby/1.8/rake.rb:546:in execute’ /usr/lib/ruby/1.8/rake.rb:541:in `each’

/usr/lib/ruby/1.8/rake.rb:541:in execute' /usr/lib/ruby/1.8/rake.rb:508:in invoke_with_call_chain’ /usr/lib/ruby/1.8/rake.rb:501:in synchronize' /usr/lib/ruby/1.8/rake.rb:501:in invoke_with_call_chain’

/usr/lib/ruby/1.8/rake.rb:494:in invoke' /home/srdan/rails/authlogic_example/vendor/rails/railties/lib/tasks/gems.rake:15 /usr/lib/ruby/1.8/rake.rb:546:in call’ /usr/lib/ruby/1.8/rake.rb:546:in `execute’

/usr/lib/ruby/1.8/rake.rb:541:in each' /usr/lib/ruby/1.8/rake.rb:541:in execute’ /usr/lib/ruby/1.8/rake.rb:508:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:501:in synchronize’ /usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain’

/usr/lib/ruby/1.8/rake.rb:518:in invoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:1183:in each’ /usr/lib/ruby/1.8/rake.rb:1183:in send' /usr/lib/ruby/1.8/rake.rb:1183:in each’ /usr/lib/ruby/1.8/rake.rb:515:in `invoke_prerequisites’

/usr/lib/ruby/1.8/rake.rb:507:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:501:in synchronize’ /usr/lib/ruby/1.8/rake.rb:501:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:494:in invoke’

/usr/lib/ruby/1.8/rake.rb:1931:in invoke_task' /usr/lib/ruby/1.8/rake.rb:1909:in top_level’ /usr/lib/ruby/1.8/rake.rb:1909:in each' /usr/lib/ruby/1.8/rake.rb:1909:in top_level’ /usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling’

/usr/lib/ruby/1.8/rake.rb:1903:in top_level' /usr/lib/ruby/1.8/rake.rb:1881:in run’ /usr/lib/ruby/1.8/rake.rb:1948:in standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1878:in run’ /usr/bin/rake:28

Could you explain a bit more what you mean when you say that Rails is ‘frozen’? Do you mean the version is frozen? If so, how can i unfreeze the version?

Thank you

Hi,

From the link that you sent, the fix seems to be to add the line:

Gem.source_index.add_spec(Gem.loaded_specs[stub])

To 'initializer.rb'. I've tried adding this line to '/var/lib/gems/1.8/gems/rails-2.3.4/lib/initializer.rb'.

That's not going to work for three reasons:

- the bug in 2.1.0 was bigger than that. - the file you've modified is a Rails 2.3.4 file, not 2.1.0. - that file isn't being loaded by your application.

Adding it to the file gave the following error:

$ rake gems:install --trace

[snip]

/home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/initializer.rb:242:in `each' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/ini tializer.rb:242:in `add_gem_load_paths' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/ini tializer.rb:115:in `process' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/ini tializer.rb:93:in `send' /home/srdan/rails/authlogic_example/config/../vendor/rails/railties/lib/ini tializer.rb:93:in `run'

[snip] Note the paths here - your app is loading Rails from /home/srdan/rails/ authlogic_example/vendor/rails, not from the system gems.

Could you explain a bit more what you mean when you say that Rails is 'frozen'? Do you mean the version is frozen? If so, how can i unfreeze the version?

Here's a quick rundown on freezing Rails: http://www.softiesonrails.com/2008/1/3/freezing-your-rails-application

I'm somewhat confused as to how you got into this situation; the authlogic_example project on github has 2.2.0 (or higher) installed in even the very oldest versions, and you've indicated that you're unfamiliar with freezing Rails. You may want to grab a fresh copy of the example project from github and start over.

--Matt Jones

Hi,

The reason I was modifying the file that I was, is because under Ubuntu the ‘authlogic_example/vendor/…’ folders are actuall symbolic links. i.e.

$ ls -al rails/authlogic_example/vendor/

total 8 drwxr-xr-x 2 srdan srdan 4096 2009-12-02 08:20 . drwxr-xr-x 13 srdan srdan 4096 2009-12-08 07:40 … lrwxrwxrwx 1 srdan srdan 29 2009-12-02 08:20 actionmailer → /usr/share/rails/actionmailer lrwxrwxrwx 1 srdan srdan 27 2009-12-02 08:20 actionpack → /usr/share/rails/actionpack

lrwxrwxrwx 1 srdan srdan 28 2009-12-02 08:20 activemodel → /usr/share/rails/activemodel lrwxrwxrwx 1 srdan srdan 29 2009-12-02 08:20 activerecord → /usr/share/rails/activerecord lrwxrwxrwx 1 srdan srdan 31 2009-12-02 08:20 activeresource → /usr/share/rails/activeresource

lrwxrwxrwx 1 srdan srdan 30 2009-12-02 08:20 activesupport → /usr/share/rails/activesupport lrwxrwxrwx 1 srdan srdan 16 2009-12-02 08:20 rails → /usr/share/rails lrwxrwxrwx 1 srdan srdan 25 2009-12-02 08:20 railties → /usr/share/rails/railties

I’m going to take your advice and download the project and start again.

Thank you