Why can't I install the SQLite gem?

931

Solution 1

The SQLite RubyGem isn't actually a RubyGem, it's a "CGem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.

If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.

However, you might be better off just installing your Operating System's pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.

(Note: all package names pulled out of thin air, might be different on your system.)

Solution 2

You probably need the ruby dev package. For Ubuntu you have to install ruby1.8-dev which includes the ruby header files. A quick google says that the yum package is ruby-devel. so run this:

sudo yum install ruby-devel

Solution 3

When I had that problem:

gem install sqlite3 -v '1.3.9'
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

For me worked, installing the "libsqlite3-dev" with:

apt-get install libsqlite3-dev

Solution 4

I faced problem installing sqlite3-ruby gem on my fedora 13 box. It was fixed after sudo yum install sqlite-devel

Solution 5

sudo apt-get install ruby-dev

Fixed it for me.

Share:
931
rajpreet singh
Author by

rajpreet singh

Updated on July 08, 2022

Comments

  • rajpreet singh
    rajpreet singh almost 2 years

    I am a newbie to python and never used it's parallel processing modules like threading or multiprocess. I am working on a real time code problem where the output of one function is used as the input of one function. There is one big function which takes almost 3 seconds to complete. It is like a program where a person submit some documents to reception, and while his documents are being verified he is directed to somewhere other for different checks. If at the end of these checks the result of documents verification is available then the program will be failed.

    def parallel_running_function(*args):
         """It is the function which will take 3 seconds to complete"""
         output = "various documents matching and verification"
         return output
    
    def check_1(*args):
        """ check one for the task"""
    
    def check_2(*args):
        """ check two for the task"""
    
    def check_3(*args):
        """ check three for the task"""
    
    def check_4(*args):
        """ check 4 for the task"""
    
    
    def main_function():
    
        output = parallel_running_function() # need to run this function 
                                            #parallel with other functions
        output_1 = check_1()
        output_2 = check_2()
        output_3 = check_3()
        output_4 = check_4()
        if output:
           "program is successful"
        else:
            "program is failed"
    
        I need the output of parallel running function is here along with the other executed functions. If I don't get the output of that function here then program will be failed or ll give some wrong result.
    

    I am using python 2.7. I have read multiple posts about this problem using threading, subprocess and multiprocessing module of python but i couldn't get a concrete solution of this problem. What I got from other posts is seems i need to use multiprocessing module. Can someone please give me an idea about how should i overcome of this problem.

  • erik
    erik over 15 years
    The fedora rpm for the mysql headers is something like 'mysql-dev', so the correct sqlite rpm is likely to be 'sqlite3-dev'
  • barneytron
    barneytron over 15 years
    I'm using FreeBSD 7.1 right now, and I have the sqlite3-3.6.4 port installed, which provided everything that gem needed if I remember right. I'm trying to check out Rails 2.2.2 myself. Good luck Erik!
  • Dan Rosenstark
    Dan Rosenstark over 15 years
    Damn SO is cool, this is actually the right answer... I was lost trying to install the SqlLite and the problem was producing new error messages every minute. Now if the questioner would just mark this as the right answer, we'd be in business.
  • Dan Rosenstark
    Dan Rosenstark over 15 years
    It's yum on Fedora, but this is NOT the issue. It's the libsqlite3-ruby issue.
  • Dan Rosenstark
    Dan Rosenstark over 15 years
    On Ubuntu I did apt-get install libsqlite3-ruby and it worked perfectly. As root, of course...
  • Shadowfirebird
    Shadowfirebird over 14 years
    Or if you wanted to install the gem, you would need to apt-get install ruby-dev, just as Jorg says.
  • Mark Essel
    Mark Essel about 14 years
    Once again Jorg, your info has come in handy to ease my learning. Thanks again.
  • Anton Babushkin
    Anton Babushkin about 12 years
    Brilliant - this should be documented in the Ruby on Rails FAQ!
  • UserBSS1
    UserBSS1 over 8 years
    That worked but after "sudo yum install sqlite-devel"
  • R.Hull
    R.Hull almost 8 years
    This fixed it for me! +1
  • rajpreet singh
    rajpreet singh over 7 years
    Thanks @eveatles for you answer, It is quite same i was looking for. But why response.get() is failing if the parallel_running_function is a member of a class or is an instance method. It is working fine with functions but creating problems with instance method.
  • elveatles
    elveatles over 7 years
    It's because multiprocessing spawns new processes instead of threads. Because objects have an internal state that cannot be shared in memory across processes you have to use functions. If you really want to use methods, you can use threading instead.
  • rajpreet singh
    rajpreet singh over 7 years
    Thank you very much for your detailed answer and response
  • andrej
    andrej about 6 years
    yes, but this depends on ruby-2.4 and does not use rbenv-installed ruby
  • Tore Aurstad
    Tore Aurstad almost 6 years
    This tip fixed it for me. Thanks.
  • Echelon
    Echelon almost 6 years
    Yep, that was the answer for me