Python 2.5 and sqlite

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • timotoole@gmail.com

    Python 2.5 and sqlite

    Hi all,

    On a (sun) webserver that I use, there is python 2.5.1 installed. I'd
    like to use sqlite3 with this, however sqlite3 is not installed on the
    webserver. If I were able to compile sqlite using a sun machine (I
    normally use linux machines) and place this in my lunix home account
    would I be able to use python and sqlite?

    Any thoughts? I know its a bit of a stretch ...
  • david.lyon@preisshare.net

    #2
    Re: Python 2.5 and sqlite

    Quoting "timotoole@gmai l.com" <timotoole@gmai l.com>:
    Hi all,
    >
    On a (sun) webserver that I use, there is python 2.5.1 installed. I'd
    like to use sqlite3 with this, however sqlite3 is not installed on the
    webserver. If I were able to compile sqlite using a sun machine (I
    normally use linux machines) and place this in my lunix home account
    would I be able to use python and sqlite?
    >
    Any thoughts? I know its a bit of a stretch ...
    Can you ask them if sqlite3 is installed? and if not... to install it?

    You could include in your discussions "well sqlite3 is part of python"
    "if it isn't, you haven't installed python properly"

    Worth a try...

    Comment

    • Thorsten Kampe

      #3
      Re: Python 2.5 and sqlite

      * timotoole@gmail .com (Mon, 10 Nov 2008 15:33:22 -0800 (PST))
      On a (sun) webserver that I use, there is python 2.5.1 installed. I'd
      like to use sqlite3 with this, however sqlite3 is not installed on the
      webserver.
      Python comes with SQLite support. It's not necessary to have SQLite
      installed for that.
      If I were able to compile sqlite using a sun machine (I normally use
      linux machines) and place this in my lunix home account would I be
      able to use python and sqlite?
      Just go ahead and import sqlite3

      Thorsten

      Comment

      • Thorsten Kampe

        #4
        Re: Python 2.5 and sqlite

        * (Mon, 10 Nov 2008 18:48:28 -0500)
        Quoting "timotoole@gmai l.com" <timotoole@gmai l.com>:
        On a (sun) webserver that I use, there is python 2.5.1 installed. I'd
        like to use sqlite3 with this, however sqlite3 is not installed on the
        webserver. If I were able to compile sqlite using a sun machine (I
        normally use linux machines) and place this in my lunix home account
        would I be able to use python and sqlite?

        Any thoughts? I know its a bit of a stretch ...
        >
        Can you ask them if sqlite3 is installed? and if not... to install it?
        Why would he have to install SQLite?!
        You could include in your discussions "well sqlite3 is part of python"
        "if it isn't, you haven't installed python properly"
        Sqlite3 is an optional part of Python. It has no dependencies on SQLite.

        Thorsten

        Comment

        • Thorsten Kampe

          #5
          Re: Python 2.5 and sqlite

          * Thorsten Kampe (Tue, 11 Nov 2008 10:45:28 +0100)
          * (Mon, 10 Nov 2008 18:48:28 -0500)
          Can you ask them if sqlite3 is installed? and if not... to install it?
          >
          Why would he have to install SQLite?!
          >
          You could include in your discussions "well sqlite3 is part of python"
          "if it isn't, you haven't installed python properly"
          >
          Sqlite3 is an optional part of Python. It has no dependencies on SQLite.
          It seems it's not that simple. On a Gentoo host the SQLite package
          provided the necessary library. On a openSUSE host it was libsqlite.
          From my understanding SQLite (the headers) is only needed for building
          python with SQLite support (or pysqlite) from scratch.

          Thorsten

          Comment

          • =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=

            #6
            Re: Python 2.5 and sqlite

            Sqlite3 is an optional part of Python. It has no dependencies on SQLite.

            That's not true. To build the _sqlite3 module, you need the SQLite3
            sources or binaries, in addition to the Python sources.

            Regards,
            Martin

            Comment

            • Thorsten Kampe

              #7
              Re: Python 2.5 and sqlite

              * "Martin v. Löwis" (Tue, 11 Nov 2008 20:54:37 +0100)
              Sqlite3 is an optional part of Python. It has no dependencies on
              SQLite.
              >
              That's not true. To build the _sqlite3 module, you need the SQLite3
              sources or binaries, in addition to the Python sources.
              That's not what I meant: the question is, do you need SQLite /after/
              you've built from source or if you install the Python binary.

              Thorsten

              Comment

              • Guilherme Polo

                #8
                Re: Python 2.5 and sqlite

                On Tue, Nov 11, 2008 at 6:04 PM, Thorsten Kampe
                <thorsten@thors tenkampe.dewrot e:
                * "Martin v. Löwis" (Tue, 11 Nov 2008 20:54:37 +0100)
                Sqlite3 is an optional part of Python. It has no dependencies on
                SQLite.
                >>
                >That's not true. To build the _sqlite3 module, you need the SQLite3
                >sources or binaries, in addition to the Python sources.
                >
                That's not what I meant: the question is, do you need SQLite /after/
                you've built from source or if you install the Python binary.
                >
                Is that some form of tricky question ? The binary package either comes
                with the sqlite lib, or in the case of linux distributions, the
                package requires the installation of sqlite lib. If you try removing
                the sqlite lib package (in Linux), the package manager will tell you
                that python depends on it.


                --
                -- Guilherme H. Polo Goncalves

                Comment

                • =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=

                  #9
                  Re: Python 2.5 and sqlite

                  That's not what I meant: the question is, do you need SQLite /after/
                  you've built from source or if you install the Python binary.
                  Depends on how you built SQLite on your system. If it was a static
                  library, you won't need it - if it is a shared library, you certainly
                  need the shared library at run-time.

                  Regards,
                  Martin

                  Comment

                  • Thorsten Kampe

                    #10
                    Re: Python 2.5 and sqlite

                    * "Martin v. Löwis" (Tue, 11 Nov 2008 21:40:44 +0100)
                    That's not what I meant: the question is, do you need SQLite /after/
                    you've built from source or if you install the Python binary.
                    >
                    Depends on how you built SQLite on your system. If it was a static
                    library, you won't need it - if it is a shared library, you certainly
                    need the shared library at run-time.
                    Aah, thanks. Makes sense a lot. There were quite a few people here in
                    the last few days who asked how to build or use Python (or pysqlite)
                    when SQLite is not installed (and they can't because it's not their
                    system). I always said that it's not necessary to have SQLite installed
                    for /running/ Python. Seems that I was "65%" right.

                    Thorsten

                    Comment

                    • david.lyon@preisshare.net

                      #11
                      Re: Python 2.5 and sqlite

                      Can you ask them if sqlite3 is installed? and if not... to install it?
                      >
                      Why would he have to install SQLite?!
                      Seems a stupid question. If he wants to use SQLite... it needs to be
                      on the system....

                      ould include in your discussions "well sqlite3 is part of python"
                      "if it isn't, you haven't installed python properly"
                      >>
                      >Sqlite3 is an optional part of Python.
                      But Python itself is dependent upon SQlite3 being installed first...

                      try it yourself...

                      first compile python 2.5 from source without SQLite.. see if it
                      works... it won't.

                      Install Sqlite first... then compile python 2.5 from source.. python
                      sqlite support will work...

                      The dependency is within the make files of python 2.5. It checks
                      whether sqlite is installed on the machine and includes support if it
                      is there.. if not.. doesn't support it...

                      It is very logical....




                      Comment

                      • Thorsten Kampe

                        #12
                        Re: Python 2.5 and sqlite

                        * (Tue, 11 Nov 2008 17:58:15 -0500)
                        Can you ask them if sqlite3 is installed? and if not... to install
                        it?
                        Why would he have to install SQLite?!
                        >
                        Seems a stupid question. If he wants to use SQLite... it needs to be
                        on the system....
                        No.
                        ould include in your discussions "well sqlite3 is part of python"
                        "if it isn't, you haven't installed python properly"
                        >
                        Sqlite3 is an optional part of Python.
                        >
                        But Python itself is dependent upon SQlite3 being installed first...
                        >
                        try it yourself...
                        >
                        first compile python 2.5 from source without SQLite.. see if it
                        works... it won't.
                        >
                        Install Sqlite first... then compile python 2.5 from source.. python
                        sqlite support will work...
                        >
                        The dependency is within the make files of python 2.5. It checks
                        whether sqlite is installed on the machine and includes support if it
                        is there.. if not.. doesn't support it...
                        >
                        It is very logical....
                        Not at all. If you would distribute a script that uses SQLite and it
                        would depend on whether SQLite is installed or not that would be a
                        huuuuuge disadvantage.

                        Python cannot check whether SQLite is installed or not. It checks
                        whether it can find the SQLite header files. So the SQLite source (or
                        the binary) is only needed for compiling Python. If you build SQLite
                        support as a shared library, you need the libsqlite package (not the
                        SQLite binary itself) at runtime. If you build it static, you don't need
                        SQLite at all at runtime. See Martin's answer in the same thread.

                        Thorsten

                        Comment

                        • timotoole@gmail.com

                          #13
                          Re: Python 2.5 and sqlite

                          Thanks to everyone who replied. I should have been clearier with my
                          initial post. Python (2.5.1) was compiled from source on the webserver
                          that I use, without an associated sqlite present on the machine, so
                          trying "import sqlite3" in a python application gives an error, but
                          aside from that python is mostly behaving itself. Again further
                          clarification, the webserver is a sun machine, my machine is linux and
                          all drives of all machine in the network are mounted, so a
                          ssh,telnet,rlog in is not required to gain access to other machines.

                          Now with that out of the way, I'm still not clear if I can install a
                          copy of sqlite on my local machine and get that to work with python on
                          the webserver? Possibly via pysqlite?

                          On Nov 12, 8:46 am, Thorsten Kampe <thors...@thors tenkampe.dewrot e:
                          * (Tue, 11 Nov 2008 17:58:15 -0500)
                          >
                          Can you ask them if sqlite3 is installed? and if not... to install
                          it?
                          >
                          Why would he have to install SQLite?!
                          >
                          Seems a stupid question. If he wants to use SQLite... it needs to be
                          on the system....
                          >
                          No.
                          >
                          >
                          >
                          ould include in your discussions "well sqlite3 is part of python"
                          "if it isn't, you haven't installed python properly"
                          >
                          >Sqlite3 is an optional part of Python.
                          >
                          But Python itself is dependent upon SQlite3 being installed first...
                          >
                          try it yourself...
                          >
                          first compile python 2.5 from source without SQLite.. see if it
                          works... it won't.
                          >
                          Install Sqlite first... then compile python 2.5 from source.. python
                          sqlite support will work...
                          >
                          The dependency is within the make files of python 2.5. It checks
                          whether sqlite is installed on the machine and includes support if it
                          is there.. if not.. doesn't support it...
                          >
                          It is very logical....
                          >
                          Not at all. If you would distribute a script that uses SQLite and it
                          would depend on whether SQLite is installed or not that would be a
                          huuuuuge disadvantage.
                          >
                          Python cannot check whether SQLite is installed or not. It checks
                          whether it can find the SQLite header files. So the SQLite source (or
                          the binary) is only needed for compiling Python. If you build SQLite
                          support as a shared library, you need the libsqlite package (not the
                          SQLite binary itself) at runtime. If you build it static, you don't need
                          SQLite at all at runtime. See Martin's answer in the same thread.
                          >
                          Thorsten

                          Comment

                          • Thorsten Kampe

                            #14
                            Re: Python 2.5 and sqlite

                            * timotoole@gmail .com (Wed, 12 Nov 2008 01:27:01 -0800 (PST))
                            Python (2.5.1) was compiled from source on the webserver that I use,
                            without an associated sqlite present on the machine, so trying "import
                            sqlite3" in a python application gives an error, but aside from that
                            python is mostly behaving itself. Again further clarification, the
                            webserver is a sun machine, my machine is linux and all drives of all
                            machine in the network are mounted, so a ssh,telnet,rlog in is not
                            required to gain access to other machines.
                            >
                            Now with that out of the way, I'm still not clear if I can install a
                            copy of sqlite on my local machine and get that to work with python on
                            the webserver? Possibly via pysqlite?
                            No, if Python was compiled without SQLite support or pysqlite is not
                            installed on that machine it will not run anything SQLite related.

                            Thorsten

                            Comment

                            • timotoole@gmail.com

                              #15
                              Re: Python 2.5 and sqlite

                              On Nov 12, 10:14 am, Thorsten Kampe <thors...@thors tenkampe.dewrot e:
                              * timoto...@gmail .com (Wed, 12 Nov 2008 01:27:01 -0800 (PST))
                              >
                              Python (2.5.1) was compiled from source on the webserver that I use,
                              without an associated sqlite present on the machine, so trying "import
                              sqlite3" in a python application gives an error, but aside from that
                              python is mostly behaving itself. Again further clarification, the
                              webserver is a sun machine, my machine is linux and all drives of all
                              machine in the network are mounted, so a ssh,telnet,rlog in is not
                              required to gain access to other machines.
                              >
                              Now with that out of the way, I'm still not clear if I can install a
                              copy of sqlite on my local machine and get that to work with python on
                              the webserver? Possibly via pysqlite?
                              >
                              No, if Python was compiled without SQLite support or pysqlite is not
                              installed on that machine it will not run anything SQLite related.
                              >
                              Thorsten

                              ok, thanks for the clarification Thorsten. would it be the same
                              situation trying to get another db such as MySQL or PostgreSQL working?

                              Comment

                              Working...