Rails/Ruby Error When Creating Database: Unable to load the EventMachine C extension
Asked Answered
S

7

7

Update:

the eventmachine gem is installed and in my gemfile:

 eventmachine (1.0.0, 0.12.10)

Please help! Trying to create a database with the following:

Fitzs-MacBook-Pro:twilio_insanity Fitz$ rake db:create'

Returns the following error:

Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' rake aborted! cannot load such file -- rubyeventmachine /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/eventmachine-1.0.0/lib/eventmachine.rb:8:in ' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/gems/thin-1.5.0/lib/thin.rb:7:in ' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in block (2 levels) in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in block in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in each' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in require' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb:128:in require' /Users/Fitz/Desktop/twilio_insanity/config/application.rb:7:in' /Users/Fitz/Desktop/twilio_insanity/Rakefile:5:in require' /Users/Fitz/Desktop/twilio_insanity/Rakefile:5:in' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in eval' /Users/Fitz/.rvm/gems/ruby-1.9.3-p327@rails3tutorial2ndEd/bin/ruby_noexec_wrapper:14:in ' (See full trace by running task with --trace)

```

Salop answered 3/1, 2013 at 6:26 Comment(4)
Have you installed required gems? Run gem list in your project folder to see if you have required gems in place. try installing gems gem install eventmachineArithmomancy
yeah it is...updated my question to reflect that. any other thoughts?Salop
This comment in another thread seems promising for your issue. Can you ensure that you have "gem eventmachine" or similar in your Gemfile, and can successfully bundle?Syllabify
that was basically it...separate versions of ruby which was confusing my installed gems. Thanks!Salop
S
4

Someone kind of answered in comments...see below.

Basically though I had seperate versions of Ruby, which was getting confusing because some gems were only installed on certain versions of ruby.

Fix was totally uninstalling ruby and rails, then reinstalling. Fixed it!

This helped:

This comment in another thread seems promising for your issue. Can you ensure that you have "gem eventmachine" or similar in your Gemfile, and can successfully bundle? – Scott Helm Jan 6 at 6:24

Salop answered 10/1, 2013 at 4:38 Comment(2)
while reinstalling seem like a crazy idea, in my case I had one version of ruby installed with rvm and another with brew. So this actually worksTrinia
I fixed the issue by simply uninstalling eventmachine, and then installing it again.Duvetyn
V
11

try to re-install the gem 'eventmachine'

$ gem uninstall eventmachine

then

$ bundle install  ( in the same folder with your Gemfile) 

or just

$ gem install eventmachine ( if you are not using the Gemfile) 

see: https://mcmap.net/q/392498/-rails-cannot-run-app-unable-to-load-the-eventmachine-c-extension

Valley answered 19/12, 2013 at 10:3 Comment(0)
S
4

Someone kind of answered in comments...see below.

Basically though I had seperate versions of Ruby, which was getting confusing because some gems were only installed on certain versions of ruby.

Fix was totally uninstalling ruby and rails, then reinstalling. Fixed it!

This helped:

This comment in another thread seems promising for your issue. Can you ensure that you have "gem eventmachine" or similar in your Gemfile, and can successfully bundle? – Scott Helm Jan 6 at 6:24

Salop answered 10/1, 2013 at 4:38 Comment(2)
while reinstalling seem like a crazy idea, in my case I had one version of ruby installed with rvm and another with brew. So this actually worksTrinia
I fixed the issue by simply uninstalling eventmachine, and then installing it again.Duvetyn
V
3

I got the same error on Windows after upgrading ruby from 1.9.3 to 2.4. I tried every fix I found but the only thing that helped in the end was (not that obvious and therefore hard to find) to reinstall the new Ruby again with 32 bit instead of 64.

Also I installed Eventmachine with

gem install eventmachine --platform=ruby

to force native compilation, since I always get problems with msgpack, that can be solved like this (haven't tried it with the default x86-mingw32)

Voltaic answered 12/1, 2018 at 15:34 Comment(0)
M
1

I am on windows 10. C:\Ruby25-x64\lib\ruby\gems>bundle install showed Could not locate Gemfile error(though, i am having bundle gem installed and present at \gems location). Following worked for me to resolve Unable to load the EventMachine C extension error:

  1. gem uninstall eventmachine
  2. gem install eventmachine --platform ruby
Misfeasance answered 24/8, 2018 at 16:41 Comment(0)
C
0

Just try the following:

apt-get install libssl0.9.8

It fixed the error on Ubuntu 12.4

Cephalopod answered 15/1, 2013 at 7:11 Comment(0)
T
0

If any of this solutions don't work, try reinstalling eventmachine gem from sources using method that worked for me on OS X: https://mcmap.net/q/392498/-rails-cannot-run-app-unable-to-load-the-eventmachine-c-extension

Teethe answered 6/1, 2014 at 12:31 Comment(0)
S
-2

Make sure you bundle eventmachine in your Gemfile

gem "eventmachine"

Then bundle install. This comment seemed relevant to you.

Syllabify answered 6/1, 2013 at 12:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.