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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b488e1be2db29c8489d80d59818b17e?d=identicon&s=25 Jeffrey 'jf' Lim (Guest)
on 2007-04-09 12:36
(Received via mailing list)
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
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2007-04-09 12:45
(Received via mailing list)
On 4/9/07, Jeffrey 'jf' Lim <jfs.world@gmail.com> 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
F0d821a746f93cece1240d52d3e2617f?d=identicon&s=25 Pierre-Charles David (Guest)
on 2007-04-09 12:46
(Received via mailing list)
2007/4/9, Jeffrey 'jf' Lim <jfs.world@gmail.com>:
> -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'"
Ac0085dae0703db56ad7f8cb9e1798ba?d=identicon&s=25 Phillip Gawlowski (Guest)
on 2007-04-09 12:49
(Received via mailing list)
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:

22. Backward compatibility is your worst enemy.

23. Backward compatibility is your users' best friend.
7b488e1be2db29c8489d80d59818b17e?d=identicon&s=25 Jeffrey 'jf' Lim (Guest)
on 2007-04-09 12:53
(Received via mailing list)
On 4/9/07, Pierre-Charles David <pcdavid@gmail.com> 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
7b488e1be2db29c8489d80d59818b17e?d=identicon&s=25 Jeffrey 'jf' Lim (Guest)
on 2007-04-09 12:59
(Received via mailing list)
On 4/9/07, Phillip Gawlowski <cmdjackryan@googlemail.com> 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!!! ;P

-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
This topic is locked and can not be replied to.