Jump to content

The ultimate community for Ruby on Rails developers.


Photo

cannot load such file -- sqlite3/sqlite3_native (LoadError)

sqlite3

  • Please log in to reply
29 replies to this topic

#1 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 15 August 2013 - 07:32 PM

Hi all, I'm on Debian Wheezy, i've installed ruby (v 2.0.0), rails (v 4.0.0), sqlite3 and the gem sqlite3, here is the list of the installed gems:

 

*** LOCAL GEMS ***
 
actionmailer (4.0.0)
actionpack (4.0.0)
activemodel (4.0.0)
activerecord (4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
arel (4.0.0)
atomic (1.1.13)
builder (3.1.4)
bundler (1.3.5)
coffee-rails (4.0.0)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.3)
i18n (0.6.5)
jbuilder (1.5.0)
jquery-rails (3.0.4)
json (1.8.0)
mail (2.5.4)
mime-types (1.24)
minitest (4.7.5)
multi_json (1.7.9)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.0)
railties (4.0.0)
rake (10.1.0)
rdoc (3.12.2)
sass (3.2.10)
sass-rails (4.0.0)
sdoc (0.3.20)
sprockets (2.10.0)
sprockets-rails (2.0.0)
sqlite3 (1.3.7)
thor (0.18.1)
thread_safe (0.1.2)
tilt (1.4.1)
treetop (1.4.14)
turbolinks (1.3.0)
tzinfo (0.3.37)
uglifier (2.1.2)
 
 
I've created a rails project,  but when I start the server using "rails server" I got this error:
 
/usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/manuele/Software/blog/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
 
 
Here is my GemFile:
 
 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
 
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
 
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
 
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
 
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
 
# See https://github.com/s...n/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
 
# Use jquery as the JavaScript library
gem 'jquery-rails'
 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
 
group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end
 
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
 
# Use unicorn as the app server
# gem 'unicorn'
 
# Use Capistrano for deployment
# gem 'capistrano', group: :development
 
# Use debugger
# gem 'debugger', group: [:development, :test]
 
 
 
Can someone help me, please? 
 
Thanks guys!!
 
 


#2 Ohm

Ohm

    Guard

  • Members
  • 184 posts
  • LocationCopenhagen

Posted 15 August 2013 - 07:45 PM

When searching Google various posts pop up suggesting to install libsqlite3-dev via apt-get


  • Jakson Rochelly likes this

Blog: http://ohm.sh | Twitter: madsohm


#3 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 15 August 2013 - 08:00 PM

yeeees, already did... doesn't solve the issue.

 

I've installed ruby and rails and gem and sqlite the same way I did some months ago, with rails 2.x... So I installed all the needed libraries...

 

 

Thanks



#4 Kelli Shaver

Kelli Shaver

    Inspector

  • Administrators
  • 75 posts
  • LocationKentucky

Posted 15 August 2013 - 09:29 PM

How do you have Ruby installed, RVM, rbenv, native? Is this an upgrade from 1.9.3 or a clean 2.0 install?



#5 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 07:00 AM

It's a clean install, 2.0.0, from the offiial website, ./configure, make, make install... any warning or errors appeared...



#6 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 07:39 AM

and debian wheezy is a clean install... So i just installed the following libraries, then ruby, gem, rails, gem sqlite3 and create a new project:

 

zlib1g zlib1g-dev build-essential sqlite3 libsqlite3-dev openssl libssl-dev libyaml-dev



#7 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 07:40 AM

oh well... the only things changed from my other rails project are Rails 4.0.0 and new pc 64 bit



#8 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 08:52 AM

Great! The first answer solved the issue! http://stackoverflow...n-ruby-on-rails



#9 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 09:21 AM

Oh nooo, now the rails server starts correctly, but when I simply surf to localhost:3000 I get this error:

 

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.


#10 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 16 August 2013 - 09:26 AM

 

Oh nooo, now the rails server starts correctly, but when I simply surf to localhost:3000 I get this error:

 

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

 

 

Please can you share database.yml?

 

Make sure your adapter is sqlite3 and not sqlite-ruby like I've seen coming from older versions.

 

This is mine on a fresh new rails app using Ruby 2 and Rails 4.

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#11 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 10:10 AM

yes, of course it is like that:

 

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000
 
So the only packages i need to install is sqlite3, libsqlite3-dev and the gem sqlite3, right?


#12 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 01:07 PM

the sqlite3 db is installed correctly, i've created a sample db, with sopme tables...it works... :(



#13 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 16 August 2013 - 03:40 PM

pffff, how many lost time  :(



#14 katafrakt

katafrakt

    Signalman

  • Members
  • 16 posts
  • LocationKrak√≥w, PL

Posted 16 August 2013 - 09:52 PM

I've run into some issues with bundler and 64-bit ruby 2.0 when I tried it recently. You may want to check if the sqlite3 gem version in Gemfile.lock is exactly the same as in gem list. In my case there were x64 gems in the system but bundler locked x86 in Gemfile.lock and it just did not work. 



#15 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 17 August 2013 - 08:59 AM

Yes in the Gemfile.lock i found:

 

sqlite3 (1.3.7)

 

and running gem list i found:

 

sqlite3 (1.3.7)
 
 
.... :(


#16 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 17 August 2013 - 02:11 PM

 

Yes in the Gemfile.lock i found:

 

sqlite3 (1.3.7)

 

and running gem list i found:

 

sqlite3 (1.3.7)
 
 
.... :(

 

 

Did you delete the gemfile.lock and re-bundle?


Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#17 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 17 August 2013 - 03:31 PM

already done as said... delete gemfile.lock and re-bundle: same error, nothing changes :(



#18 cicolink

cicolink

    Signalman

  • Members
  • 17 posts

Posted 17 August 2013 - 03:45 PM

here is the complete error trace:

 

LoadError (Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.):
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `require'
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `block in require'
  activesupport (4.0.0) lib/active_support/dependencies.rb:213:in `load_dependency'
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `require'
  activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:6:in `<top (required)>'
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `require'
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `block in require'
  activesupport (4.0.0) lib/active_support/dependencies.rb:213:in `load_dependency'
  activesupport (4.0.0) lib/active_support/dependencies.rb:228:in `require'
  activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:56:in `resolve_hash_connection'
  activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
  activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
  activerecord (4.0.0) lib/active_record/connection_handling.rb:39:in `establish_connection'
  activerecord (4.0.0) lib/active_record/railtie.rb:175:in `block (2 levels) in <class:Railtie>'
  activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
  activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
  activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
  activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:44:in `each'
  activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  activerecord (4.0.0) lib/active_record/base.rb:322:in `<module:ActiveRecord>'
  activerecord (4.0.0) lib/active_record/base.rb:22:in `<top (required)>'
  activerecord (4.0.0) lib/active_record/query_cache.rb:50:in `restore_query_cache_settings'
  activerecord (4.0.0) lib/active_record/query_cache.rb:43:in `rescue in call'
  activerecord (4.0.0) lib/active_record/query_cache.rb:32:in `call'
  activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
  activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__2273478188089806387__call__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /usr/local/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /usr/local/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /usr/local/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'




  Rendered /usr/local/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.9ms)
  Rendered /usr/local/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
  Rendered /usr/local/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.7ms)
  Rendered /usr/local/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (25.5ms)

Edited by Jamie, 17 August 2013 - 04:03 PM.
Added code tags


#19 Jamie

Jamie

    Controller

  • Moderators
  • 114 posts
  • LocationThe UK

Posted 17 August 2013 - 04:04 PM

Would you mind sharing your application to GitHub or BitBucket for me to download and try on my machine?


Rails developer based in Newcastle, UK.
Web app owner - Twitter lover

#20 james

james

    Guard

  • Moderators
  • 221 posts
  • LocationLeeds, U.K.

Posted 17 August 2013 - 04:07 PM

Would you mind sharing your application to GitHub or BitBucket for me to download and try on my machine?

 

This is not an application issue, it's an environment issue. Caused probably by the manual installation method used.

 

Could I recommend installing rvm then running  rvm requirements --autolibs=enable. This should get your OS set up the way it needs to be.

You can then remove rvm and carry on manually. This might give you the quick fix you need.


  • Jamie and Tom like this

Programming is just about problem solving!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users