"require 'sqlite3'" gives "no such file to load -- sqlite3 (


#1

hi, folks, I have been hacking away at this thing for a number of
hours now, and have found no solution. I have absolutely no idea what
happened here, but I do know for a fact that this has always been
working all along. I have ruby (from source), sqlite (from source),
gems, and the sqlite3-ruby gem installed, but try as I might, i keep
hitting into this error. What’s wrong?

==========

ruby -e “require ‘sqlite3’”

-e:1:in `require’: no such file to load – sqlite3 (LoadError)

==========

irb

irb(main):001:0> require ‘sqlite3’
LoadError: no such file to load – sqlite3
from (irb):1:in `require’
from (irb):1

===========

I have tried installing, uninstalling, and reinstalling all the
components (ruby, sqlite, gems, sqlite3-ruby gem)… all to no avail.
I have even (just to be sure), scrubbed the /usr/local/lib/ruby
directory clean once (since there is no ‘make uninstall’ for a lot of
the components), and then reinstalling everything all over again. No
luck. Is there something that i am missing here?

And to top it all off, the ridiculous thing is that a freshly
generated rails instance, with an sqlite3 adapter can still work - I
can still generate migrations, run the migrations, and use the
‘sqlite3’ binary to check the db to see that the table has been
created!

Has somebody help me here, pls?

thanks,
-jf


“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation

http://kerneltrap.org/node/7228


#2

On 4/9/07, Jeffrey ‘jf’ Lim removed_email_address@domain.invalid wrote:

hi, folks, I have been hacking away at this thing for a number of
hours now, and have found no solution. I have absolutely no idea what
happened here, but I do know for a fact that this has always been
working all along. I have ruby (from source), sqlite (from source),
gems, and the sqlite3-ruby gem installed, but try as I might, i keep
hitting into this error. What’s wrong?

Just a quick guess, would you not miss something like
require "rubygems’
on top of everything else?

HTH
Robert


#3

Jeffrey ‘jf’ Lim wrote:

-e:1:in `require’: no such file to load – sqlite3 (LoadError)
Have you set RUBYOPT in your environment?
If not, have you tried to use “require ‘rubygems’”?
Are your permissions for the gem directory correct? (They probably are,
as rails still works.)
Have you checked how rails invokes sqlite3?

I have sqlite3 working on Windows and Ubuntu Linux 6.10, and have hit
that only when I forgot to load rubygems beforehand.


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/

Rules of Open-Source Programming:

  1. Backward compatibility is your worst enemy.

  2. Backward compatibility is your users’ best friend.


#4

2007/4/9, Jeffrey ‘jf’ Lim removed_email_address@domain.invalid:

-e:1:in `require’: no such file to load – sqlite3 (LoadError)
If you installed sqlite3 as a gem, you need to “require ‘rubygems’”
first as gems have their own search path/logic:

% ruby -e “require ‘rubygems’; require ‘sqlite3’”


#5

On 4/9/07, Pierre-Charles D. removed_email_address@domain.invalid wrote:

If you installed sqlite3 as a gem, you need to “require ‘rubygems’”
first as gems have their own search path/logic:

% ruby -e “require ‘rubygems’; require ‘sqlite3’”

ah, thanks, folks!! I didnt realize that… I had previously installed
sqlite3-ruby as a non-gem - perhaps that was why… Thanks!

-jf


“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation

http://kerneltrap.org/node/7228


#6

On 4/9/07, Phillip G. removed_email_address@domain.invalid wrote:

Have you set RUBYOPT in your environment?

nope! never had a need to, actually. But thanks for all the help and
suggestions - really appreciated it… Oh, and, interesting sig!!! :stuck_out_tongue_winking_eye:

-jf


“It’s so hard to write a graphics driver that open-sourcing it would not
help.”
– Andrew Fear, Software Product Manager, NVIDIA Corporation

http://kerneltrap.org/node/7228