How to build the pysqlite? Where to find the "sqlite3.h"?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kurda Yon

    How to build the pysqlite? Where to find the "sqlite3.h"?

    Hi,

    I try to "build" and "install" pysqlite? After I type "python setup.py
    build" I get a lot of error messages? The first error is "src/
    connection.h:33 :21: error: sqlite3.h: No such file or directory". So,
    I assume that the absence of the "sqlite3.h" is the origin of the
    problem.

    I found on the web, that this file should be either in "/usr/local/
    include" or in "/usr/local/lib". I check this directories and I really
    do not have the "sqlite3.h" there.

    Thinks becomes even more complicated since I have no permissions to
    write to the 2 above mentioned directories? So, do I have any chance
    to install the pysqlite? If yes, what should I do?

    Should I find the file on the web and put in in some of my directories
    and then to change the path in the "setup.cfg" ?

    Thank you for any help.
  • saju.pillai@gmail.com

    #2
    Re: How to build the pysqlite? Where to find the "sqlite3.h "?

    On Nov 5, 6:47 am, Kurda Yon <kurda...@yahoo .comwrote:
    Hi,
    >
    I try to "build" and "install" pysqlite? After I type "python setup.py
    build" I get a lot of error messages? The first error  is "src/
    connection.h:33 :21: error: sqlite3.h: No such file or directory". So,
    I assume that the absence of the "sqlite3.h" is the origin of the
    problem.
    >
    You can try downloading sqlite3 from the web and installing it in a
    local dir. Update pysqlite setup.cfg to add these local dir names and
    then try building it.

    -srp

    I found on the web, that this file should be either in "/usr/local/
    include" or in "/usr/local/lib". I check this directories and I really
    do not have the "sqlite3.h" there.
    >
    Thinks becomes even more complicated since I have no permissions to
    write to the 2 above mentioned directories? So, do I have any chance
    to install the pysqlite? If yes, what should I do?
    >
    Should I find the file on the web and put in in some of my directories
    and then to change the path in the "setup.cfg" ?
    >
    Thank you for any help.

    Comment

    • Kurda Yon

      #3
      Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

      On Nov 4, 8:59 pm, "saju.pil...@gm ail.com" <saju.pil...@gm ail.com>
      wrote:
      On Nov 5, 6:47 am, Kurda Yon <kurda...@yahoo .comwrote:
      >
      Hi,
      >
      I try to "build" and "install" pysqlite? After I type "python setup.py
      build" I get a lot of error messages? The first error is "src/
      connection.h:33 :21: error: sqlite3.h: No such file or directory". So,
      I assume that the absence of the "sqlite3.h" is the origin of the
      problem.
      >
      You can try downloading sqlite3 from the web and installing it in a
      local dir. Update pysqlite setup.cfg to add these local dir names and
      then try building it.
      >
      -srp
      >
      I see the problem. The pysqlite is a package which allows a
      communication between the python and sqlite. I try to install the
      "pysqlite" but I do not have the "sqlite" on my computer. So, I have
      the problem. I tried to find out how to install the sqlite3 but it
      seems there are no simple and clear explanations of how to do it. So,
      I think I will give up and search for an easier way. Tank you for your
      help.
      I found on the web, that this file should be either in "/usr/local/
      include" or in "/usr/local/lib". I check this directories and I really
      do not have the "sqlite3.h" there.
      >
      Thinks becomes even more complicated since I have no permissions to
      write to the 2 above mentioned directories? So, do I have any chance
      to install the pysqlite? If yes, what should I do?
      >
      Should I find the file on the web and put in in some of my directories
      and then to change the path in the "setup.cfg" ?
      >
      Thank you for any help.

      Comment

      • david.lyon@preisshare.net

        #4
        Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?


        Hi Kurda,

        I have been through this problem. Somebody needs to write a FAQ.

        Took me a few days to pinpoint the problem.

        Don't know which platform but I assume Linux...

        Python depends upon Sqlite... which is weird... but it is what I discovered....

        When Python is being built.. it checks for sqlite3.h.. in it's
        'configure' script. If it is not there it doesn't provide any support
        for it.

        Other databases go 'ontop' of the language... so once you install your
        compiler/interpretor, you install your database. That is my experience.

        Anyway, it is the other way around with sqlite. Install sqlite.. then
        build python... then it will all work.....

        The trick is having sqlite installed before the 'make configure' step
        in the install process.

        If you have sophisticated packaging system in your linux... then use that...

        Regards

        David

        Quoting Kurda Yon <kurdayon@yahoo .com>:
        On Nov 4, 8:59 pm, "saju.pil...@gm ail.com" <saju.pil...@gm ail.com>
        wrote:
        >On Nov 5, 6:47 am, Kurda Yon <kurda...@yahoo .comwrote:
        >>
        Hi,
        >>
        I try to "build" and "install" pysqlite? After I type "python setup.py
        build" I get a lot of error messages? The first error is "src/
        connection.h:33 :21: error: sqlite3.h: No such file or directory". So,
        I assume that the absence of the "sqlite3.h" is the origin of the
        problem.
        >>
        >You can try downloading sqlite3 from the web and installing it in a
        >local dir. Update pysqlite setup.cfg to add these local dir names and
        >then try building it.
        >>
        >-srp
        >>
        >
        I see the problem. The pysqlite is a package which allows a
        communication between the python and sqlite. I try to install the
        "pysqlite" but I do not have the "sqlite" on my computer. So, I have
        the problem. I tried to find out how to install the sqlite3 but it
        seems there are no simple and clear explanations of how to do it. So,
        I think I will give up and search for an easier way. Tank you for your
        help.
        >
        I found on the web, that this file should be either in "/usr/local/
        include" or in "/usr/local/lib". I check this directories and I really
        do not have the "sqlite3.h" there.
        >>
        Thinks becomes even more complicated since I have no permissions to
        write to the 2 above mentioned directories? So, do I have any chance
        to install the pysqlite? If yes, what should I do?
        >>
        Should I find the file on the web and put in in some of my directories
        and then to change the path in the "setup.cfg" ?
        >>
        Thank you for any help.
        >
        --

        >


        Comment

        • saju.pillai@gmail.com

          #5
          Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

          On Nov 5, 12:29 pm, Dennis Lee Bieber <wlfr...@ix.net com.comwrote:
          On Tue, 04 Nov 2008 21:58:17 -0500, david.l...@prei sshare.net declaimed
          the following in comp.lang.pytho n:
          >
          Python depends upon Sqlite... which is weird... but it is what I discovered...
          >
                  Not really (weird). Python, as of 2.5, includes the PySQLite DB-API
          adapter as part of the native library/source code. BUT SQLite is NOT
          part of Python (the Windows installers typically include the SQLite
          engine as a convenience, but Linux installers expect the engine to
          already be available).

          To clarify further. sqlite is supported in python by providing python
          language bindings over the sqlite *native* apis. SQLite is written in
          C; pysqlite uses the SQLite C api and intelligently glues it into the
          python interpreter and makes python language apis available to you.
          This is why Python (pysqlite2 rather) depends on the native SQLite
          libraries

          This is usually how any new functionality would be made available in
          python - by writing python wrappers over the existing native
          libraries. The other method would be to re-implement the complete
          functionality in pure python (an eg of this technique would be
          paramiko which implements SSH2 in pure python)

          -srp
          >
                  None of the other database adapters are part of the base library.
          --
                  Wulfraed        Dennis Lee Bieber              KD6MOG
                  wlfr...@ix.netc om.com              wulfr...@bestia ria.com
                          HTTP://wlfraed.home.netcom.com/
                  (Bestiaria Support Staff:               web-a...@bestiaria. com)
                          HTTP://www.bestiaria.com/

          Comment

          • Shawn Milochik

            #6
            Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

            This is all useful and interesting stuff, but I don't think any of it
            addresses the original poster's problem, which is that he has no root
            access to a Linux or Unix box, and wants to get pysqlite2 working in
            his home directory. I have exactly the same problem. I have tried the
            "python setup.py install --home=~" method, and I get errors from GCC
            that I have no permissions (and to be honest, nor the knowledge) to
            overcome.

            Isn't there anyway to get a Linux binary that can just be put
            somewhere in the Python path so we can use sqlite? Or are those of us
            without admin/root control of our boxes screwed?

            Comment

            • saju.pillai@gmail.com

              #7
              Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

              On Nov 5, 9:22 pm, "Shawn Milochik" <Sh...@milochik .comwrote:
              This is all useful and interesting stuff, but I don't think any of it
              addresses the original poster's problem, which is that he has no root
              access to a Linux or Unix box, and wants to get pysqlite2 working in
              his home directory. I have exactly the same problem. I have tried the
              "python setup.py install --home=~" method, and I get errors from GCC
              that I have no permissions (and to be honest, nor the knowledge) to
              overcome.
              >
              Isn't there anyway to get a Linux binary that can just be put
              somewhere in the Python path so we can use sqlite? Or are those of us
              without admin/root control of our boxes screwed?
              1. Get sqlite3 from http://www.sqlite.org/sqlite-3.6.4.tar.gz
              2. build and install sqlite3 (./configure --prefix=/any/writeable/dir
              && make install) -- you may want to supply the --disable-tcl flag if
              you hit permission problems
              3. get pysqlite3, edit setup.cfg libraries and include lines to point
              to the lib/ and include/ dir where you installed sqlite3 in the
              previous step
              4. python setup.py install --home=somewhere
              5. PYTHONPATH=some where ./python -- import pysqlite2 should work for
              you

              Comment

              • Shawn Milochik

                #8
                Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                On Wed, Nov 5, 2008 at 11:58 AM, saju.pillai@gma il.com
                <saju.pillai@gm ail.comwrote:
                On Nov 5, 9:22 pm, "Shawn Milochik" <Sh...@milochik .comwrote:
                >This is all useful and interesting stuff, but I don't think any of it
                >addresses the original poster's problem, which is that he has no root
                >access to a Linux or Unix box, and wants to get pysqlite2 working in
                >his home directory. I have exactly the same problem. I have tried the
                >"python setup.py install --home=~" method, and I get errors from GCC
                >that I have no permissions (and to be honest, nor the knowledge) to
                >overcome.
                >>
                >Isn't there anyway to get a Linux binary that can just be put
                >somewhere in the Python path so we can use sqlite? Or are those of us
                >without admin/root control of our boxes screwed?
                >
                1. Get sqlite3 from http://www.sqlite.org/sqlite-3.6.4.tar.gz
                2. build and install sqlite3 (./configure --prefix=/any/writeable/dir
                && make install) -- you may want to supply the --disable-tcl flag if
                you hit permission problems
                3. get pysqlite3, edit setup.cfg libraries and include lines to point
                to the lib/ and include/ dir where you installed sqlite3 in the
                previous step
                4. python setup.py install --home=somewhere
                5. PYTHONPATH=some where ./python -- import pysqlite2 should work for
                you
                --

                Thanks, but either I'm missing something or you're missing something.
                I can't do any of what you describe on the machine I want to use
                sqlite on.

                I have downloaded the binary sqlite3 file from sqlite's Web site, and
                I can use it with shell scripts and via the command line with no
                problem. The issue is that I don't seem to have any way available to
                me to use the pysqlite2 Python module.

                When I try the "python setup.py --install --home=somewhere"
                installation, it blows up on GCC errors that I do not have the
                permissions to even attempt to fix. What I was asking above was
                whether there was a way do download the pysqlite2 module as files that
                I can just copy into a directory that Python thinks is part of its
                path so I can use it without having to compile or build it in any way
                on that machine.

                Thanks,
                Shawn

                Comment

                • saju.pillai@gmail.com

                  #9
                  Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                  On Nov 5, 10:07 pm, "Shawn Milochik" <Sh...@milochik .comwrote:
                  On Wed, Nov 5, 2008 at 11:58 AM, saju.pil...@gma il.com
                  >
                  >
                  >
                  <saju.pil...@gm ail.comwrote:
                  On Nov 5, 9:22 pm, "Shawn Milochik" <Sh...@milochik .comwrote:
                  This is all useful and interesting stuff, but I don't think any of it
                  addresses the original poster's problem, which is that he has no root
                  access to a Linux or Unix box, and wants to get pysqlite2 working in
                  his home directory. I have exactly the same problem. I have tried the
                  "python setup.py install --home=~" method, and I get errors from GCC
                  that I have no permissions (and to be honest, nor the knowledge) to
                  overcome.
                  >
                  Isn't there anyway to get a Linux binary that can just be put
                  somewhere in the Python path so we can use sqlite? Or are those of us
                  without admin/root control of our boxes screwed?
                  >
                  1. Get sqlite3 fromhttp://www.sqlite.org/sqlite-3.6.4.tar.gz
                  2. build and install sqlite3 (./configure --prefix=/any/writeable/dir
                  && make install) -- you may want to supply the --disable-tcl flag if
                  you hit permission problems
                  3. get pysqlite3, edit setup.cfg libraries and include lines to point
                  to the lib/ and include/ dir where you installed sqlite3 in the
                  previous step
                  4. python setup.py install --home=somewhere
                  5. PYTHONPATH=some where ./python -- import pysqlite2 should work for
                  you
                  --
                  >
                  Thanks, but either I'm missing something or you're missing something.
                  I can't do any of what you describe on the machine I want to use
                  sqlite on.
                  >
                  I have downloaded the binary sqlite3 file from sqlite's Web site, and
                  The linux binary will not work. You need the headers and the
                  libraries. Grab the src tar ball and build and install locally.

                  -srp
                  I can use it with shell scripts and via the command line with no
                  problem. The issue is that I don't seem to have any way available to
                  me to use the pysqlite2 Python module.
                  >
                  When I try the "python setup.py --install --home=somewhere"
                  installation, it blows up on GCC errors that I do not have the
                  permissions to even attempt to fix.  What I was asking above was
                  whether there was a way do download the pysqlite2 module as files that
                  I can just copy into a directory that Python thinks is part of its
                  path so I can use it without having to compile or build it in any way
                  on that machine.
                  >
                  Thanks,
                  Shawn

                  Comment

                  • Shawn Milochik

                    #10
                    Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                    >Thanks, but either I'm missing something or you're missing something.
                    >I can't do any of what you describe on the machine I want to use
                    >sqlite on.
                    >>
                    >I have downloaded the binary sqlite3 file from sqlite's Web site, and
                    >
                    The linux binary will not work. You need the headers and the
                    libraries. Grab the src tar ball and build and install locally.
                    >
                    -srp
                    That is not correct. The binary *does* work, as I said last time.

                    For the third time, it is not possible for me to build from source on that box.

                    And in any case, you keep talking about sqlite3, but I'm talking about
                    pysqlite2.

                    Comment

                    • Thorsten Kampe

                      #11
                      Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                      * Shawn Milochik (Wed, 5 Nov 2008 12:28:46 -0500)
                      Thanks, but either I'm missing something or you're missing
                      something. I can't do any of what you describe on the machine I
                      want to use sqlite on.
                      >
                      I have downloaded the binary sqlite3 file from sqlite's Web site,
                      and
                      The linux binary will not work. You need the headers and the
                      libraries. Grab the src tar ball and build and install locally.
                      >
                      That is not correct. The binary *does* work, as I said last time.
                      >
                      For the third time, it is not possible for me to build from source on
                      that box.
                      Sure you can. There are never permission problems for compiling - only
                      for installing.
                      And in any case, you keep talking about sqlite3, but I'm talking about
                      pysqlite2.
                      You (and Kurda) keep on talking the wrong stuff. First: you don't need
                      pysqlite2. SQLite support is included in the latest Python as module
                      sqlite3.

                      If for whatever reason you need the latest SQLite module for Python
                      (2.5.0), you can simply grab an rpm or build it from source and install
                      it to your home directory. To build pysqlite you need the SQLite
                      headers. If you can't install those to default path then simply grab the
                      headers, put them somewhere into your home directory and tell the
                      pysqlite build process where to find them.

                      Thorsten

                      Comment

                      • Shawn Milochik

                        #12
                        Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                        On Wed, Nov 5, 2008 at 1:55 PM, Thorsten Kampe
                        <thorsten@thors tenkampe.dewrot e:
                        * Shawn Milochik (Wed, 5 Nov 2008 12:28:46 -0500)
                        >Thanks, but either I'm missing something or you're missing
                        >something. I can't do any of what you describe on the machine I
                        >want to use sqlite on.
                        >>
                        >I have downloaded the binary sqlite3 file from sqlite's Web site,
                        >and
                        >
                        The linux binary will not work. You need the headers and the
                        libraries. Grab the src tar ball and build and install locally.
                        >>
                        >That is not correct. The binary *does* work, as I said last time.
                        >>
                        >For the third time, it is not possible for me to build from source on
                        >that box.
                        >
                        Sure you can. There are never permission problems for compiling - only
                        for installing.
                        >
                        >And in any case, you keep talking about sqlite3, but I'm talking about
                        >pysqlite2.
                        >
                        You (and Kurda) keep on talking the wrong stuff. First: you don't need
                        pysqlite2. SQLite support is included in the latest Python as module
                        sqlite3.
                        >
                        If for whatever reason you need the latest SQLite module for Python
                        (2.5.0), you can simply grab an rpm or build it from source and install
                        it to your home directory. To build pysqlite you need the SQLite
                        headers. If you can't install those to default path then simply grab the
                        headers, put them somewhere into your home directory and tell the
                        pysqlite build process where to find them.
                        >
                        Thorsten

                        Okay, sorry if I haven't been specific enough. I don't know about the
                        original poster, but on the box I'm using, I don't have the latest
                        Python, the "make" command breaks because the system doesn't have the
                        proper libraries, and there is no sqlite3 module. I am not authorized
                        to fix any of that, and our support team isn't interested in helping
                        me because it's a Perl shop, not Python.

                        I'm not demanding that anyone solve my problem. I'm just asking if
                        there are files I can download and without compiling or building them
                        in any way, put them somewhere, point Python to that path, and be able
                        to use sqlite from Python. If the answer is no, it's no. I'm not
                        repeating myself because I enjoy it. For some reason everyone who has
                        answered me has ignored the basic question of whether this is possible
                        or not, so I have felt the need to reply and say so.

                        Thanks,
                        Shawn

                        Comment

                        • Kurda Yon

                          #13
                          Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                          On Nov 5, 1:55 pm, Thorsten Kampe <thors...@thors tenkampe.dewrot e:
                          >
                          You (and Kurda) keep on talking the wrong stuff. First: you don't need
                          pysqlite2. SQLite support is included in the latest Python as module
                          sqlite3.
                          >
                          By the way, I think the above statement is very helpfull. I tried to
                          install the "pysqlite" to be able to communicate with the "sqlite",
                          and then I have realized that for that I need first to install the
                          "sqlite"...

                          But I read your statement and understood that I do not need to install
                          neither "pysqlite" no "sqlite". In my Python session I tried to type
                          "from sqlite import connect" and it does not compaline. It meand that
                          Python see the database!!! I hope.

                          By the where can I find a simle tutorial about the work with the
                          "sqlite" from the Python?

                          Comment

                          • Thorsten Kampe

                            #14
                            Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                            * Kurda Yon (Wed, 5 Nov 2008 17:52:08 -0800 (PST))
                            On Nov 5, 1:55 pm, Thorsten Kampe <thors...@thors tenkampe.dewrot e:
                            You (and Kurda) keep on talking the wrong stuff. First: you don't
                            need pysqlite2. SQLite support is included in the latest Python as
                            module sqlite3.
                            >
                            By the way, I think the above statement is very helpfull. I tried to
                            install the "pysqlite" to be able to communicate with the "sqlite",
                            and then I have realized that for that I need first to install the
                            "sqlite"...
                            >
                            But I read your statement and understood that I do not need to install
                            neither "pysqlite" no "sqlite". In my Python session I tried to type
                            "from sqlite import connect" and it does not compaline. It meand that
                            Python see the database!!! I hope.
                            I don't think so. There is no "sqlite" module in Python so the above
                            line should give you an error. The module is called sqlite3.
                            By the where can I find a simle tutorial about the work with the
                            "sqlite" from the Python?
                            Guess where: in the Python documentation and on the pysqlite web site:
                            Source code: Lib/sqlite3/ SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard ...



                            Thorsten

                            Comment

                            • Thorsten Kampe

                              #15
                              Re: How to build the pysqlite? Where to find the &quot;sqlite3.h &quot;?

                              * Shawn Milochik (Wed, 5 Nov 2008 14:32:15 -0500)
                              On Wed, Nov 5, 2008 at 1:55 PM, Thorsten Kampe
                              You (and Kurda) keep on talking the wrong stuff. First: you don't
                              need pysqlite2. SQLite support is included in the latest Python as
                              module sqlite3.

                              If for whatever reason you need the latest SQLite module for Python
                              (2.5.0), you can simply grab an rpm or build it from source and
                              install it to your home directory. To build pysqlite you need the
                              SQLite headers. If you can't install those to default path then
                              simply grab the headers, put them somewhere into your home directory
                              and tell the pysqlite build process where to find them.
                              >
                              Okay, sorry if I haven't been specific enough. I don't know about the
                              original poster, but on the box I'm using, I don't have the latest
                              Python, the "make" command breaks because the system doesn't have the
                              proper libraries, and there is no sqlite3 module. I am not authorized
                              to fix any of that, and our support team isn't interested in helping
                              me because it's a Perl shop, not Python.
                              >
                              I'm not demanding that anyone solve my problem. I'm just asking if
                              there are files I can download and without compiling or building them
                              in any way, put them somewhere, point Python to that path, and be able
                              to use sqlite from Python.
                              I more or less answered that already: you can grab a rpm for the same
                              Python version as you already have, unpack it and put the sqlite3
                              support files somewhere into your home directory (~/bin/python/site-
                              packages for example). If your Python is older than 2.5 then you have to
                              download the pysqlite rpms for your distribution and do the same as
                              above. To have Python find the modules you have to set the PYTHONPATH
                              environment variable. See the man page.

                              If your distribution doesn't provide RPMs for pysqlite then you have to
                              build it yourself. You have to grab the SQLite headers (they are in the
                              SQLite RPM probably), unpack them somewhere into your home directory and
                              tell the pysqlite build process where to find them. I don't exactly know
                              how but this is probably very easy to find out.

                              Thorsten

                              Comment

                              Working...