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

Discussion in 'Ruby' started by Jeffrey 'jf' Lim, Apr 9, 2007.

  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
     
    Jeffrey 'jf' Lim, Apr 9, 2007
    #1
    1. Advertising

  2. Jeffrey 'jf' Lim

    Robert Dober Guest

    On 4/9/07, Jeffrey 'jf' Lim <> 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
     
    Robert Dober, Apr 9, 2007
    #2
    1. Advertising

  3. 2007/4/9, Jeffrey 'jf' Lim <>:
    > 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)


    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'"

    --
    http://pcdavid.net/
     
    Pierre-Charles David, Apr 9, 2007
    #3
  4. Jeffrey 'jf' Lim 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?
    >
    > ==========
    >
    > # ruby -e "require 'sqlite3'"
    > -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.
     
    Phillip Gawlowski, Apr 9, 2007
    #4
  5. On 4/9/07, Pierre-Charles David <> 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
     
    Jeffrey 'jf' Lim, Apr 9, 2007
    #5
  6. On 4/9/07, Phillip Gawlowski <> 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
     
    Jeffrey 'jf' Lim, Apr 9, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. B.Sathish Kumar

    aspx files gives header output in IE.

    B.Sathish Kumar, Feb 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    356
    B.Sathish Kumar
    Feb 18, 2004
  2. gh0st54
    Replies:
    6
    Views:
    8,215
    Natty Gur
    Aug 19, 2003
  3. Andrew
    Replies:
    3
    Views:
    467
    Ken Cox [Microsoft MVP]
    Sep 3, 2003
  4. Kenneth McDonald
    Replies:
    2
    Views:
    117
    Kenneth McDonald
    Sep 30, 2008
  5. Jim S.
    Replies:
    7
    Views:
    491
    Jim S.
    Apr 26, 2011
Loading...

Share This Page