By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Python 2.5 and sqlite

P: n/a
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 ...
Nov 10 '08 #1
Share this Question
Share on Google+
20 Replies


P: n/a
Quoting "ti*******@gmail.com" <ti*******@gmail.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...

Nov 10 '08 #2

P: n/a
* ti*******@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
Nov 11 '08 #3

P: n/a
* (Mon, 10 Nov 2008 18:48:28 -0500)
Quoting "ti*******@gmail.com" <ti*******@gmail.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
Nov 11 '08 #4

P: n/a
* 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
Nov 11 '08 #5

P: n/a
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
Nov 11 '08 #6

P: n/a
* "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
Nov 11 '08 #7

P: n/a
On Tue, Nov 11, 2008 at 6:04 PM, Thorsten Kampe
<th******@thorstenkampe.dewrote:
* "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.
Thorsten
--
http://mail.python.org/mailman/listinfo/python-list


--
-- Guilherme H. Polo Goncalves
Nov 11 '08 #8

P: n/a
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
Nov 11 '08 #9

P: n/a
* "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
Nov 11 '08 #10

P: n/a
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....


Nov 11 '08 #11

P: n/a
* (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
Nov 12 '08 #12

P: n/a
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,rlogin 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...@thorstenkampe.dewrote:
* (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
Nov 12 '08 #13

P: n/a
* ti*******@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,rlogin 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
Nov 12 '08 #14

P: n/a
On Nov 12, 10:14 am, Thorsten Kampe <thors...@thorstenkampe.dewrote:
* 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,rlogin 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?
Nov 12 '08 #15

P: n/a
ti*******@gmail.com wrote:
On Nov 12, 10:14 am, Thorsten Kampe <thors...@thorstenkampe.dewrote:
>* 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,rlogin 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?
No, as those database are supported by modules you have to load separately.

Seems like the easiest answer to your problem would be to install SQLite
and then rebuild the Python interpreter.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Nov 12 '08 #16

P: n/a

Thorsten,

Quoting Thorsten Kampe <th******@thorstenkampe.de>:
* (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.
really...?
Python cannot check whether SQLite is installed or not.
Of course it can....
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.
Anyway.. I think you just want to argue endlessly with silly
statements.. you're being too pedantic..

Fact is different *nux distributions come with different parts
(static/dynamic-libraries, header files etc). There is no blanket
solution that will work on every platform every time.

I know many *nix distro's work with python out of the box.. but we are
not talking about that..

Anyway.. I have work to do

Take care

David
Nov 12 '08 #17

P: n/a
* (Wed, 12 Nov 2008 17:52:55 -0500)
Quoting Thorsten Kampe <th******@thorstenkampe.de>:
* (Tue, 11 Nov 2008 17:58:15 -0500)
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.

Anyway.. I think you just want to argue endlessly with silly
statements.. you're being too pedantic..
If you think making a distinction between the SQLite package and the
libsqlite package is pedantic - I don't have a problem with that. Fact
is that none of the packages are required for using sqlite3 with Python
- they are only required when you want to compile Python yourself or
when Python uses the shared library.

And even if you want to compile Python yourself, SQLite doesn't have to
be _installed_. You simply can dump the files wherever you like and
point Python to it. This is often necessary on a machine where you
cannot install anything to the default locations because you don't have
admin rights.

Thorsten
Nov 13 '08 #18

P: n/a
Quoting Thorsten Kampe <th******@thorstenkampe.de>:
And even if you want to compile Python yourself, SQLite doesn't have to
be _installed_. You simply can dump the files wherever you like and
point Python to it. This is often necessary on a machine where you
cannot install anything to the default locations because you don't have
admin rights.
Oh.. ok now I understand what you were trying to say.

That is fair enough.

Take care

David
Nov 13 '08 #19

P: n/a
If you think making a distinction between the SQLite package and the
libsqlite package is pedantic - I don't have a problem with that.
I think that is not only pedantic - it is also inaccurate. There is
no SQLite package, nor is there a libsqlite package, in the bigger+
world. From

http://www.sqlite.org/download.html

I can download the following pieces:

sqlite3-x.y.z.bin.gz (for Linux, likewise for OSX and Windows)
tclsqlite3* (Tcl bindings - clearly irrelevant here)
sqlite-x.y.z.so.gz (for Linux, likewise for Windows)
sqlite3_analyzer-x.y.z (also clearly irrelevant here)
sqlite-amalgation-x.y.z (amalgated sources)
sqlite-x.y.z (complete sources, in tar.gz and .zip)

So there is no SQLite download, nor is there a libsqlite download.

I don't know what specific packages you are talking about - probably
about the way your Linux distribution choses to package things.
Fact
is that none of the packages are required for using sqlite3 with Python
- they are only required when you want to compile Python yourself or
when Python uses the shared library.
So the shared library *is* required (as that is the typical way in which
SQLite is built)
And even if you want to compile Python yourself, SQLite doesn't have to
be _installed_. You simply can dump the files wherever you like and
point Python to it. This is often necessary on a machine where you
cannot install anything to the default locations because you don't have
admin rights.
And that is nit-picking. You don't have to do the "make install" step,
but I would suggest to do that, anyway, even on a machine where
you don't have admin rights. You just pass --prefix to the configure
of the amalgamated sources. This puts sqlite nicely into bin, include,
and lib directories, so that Python's setup.py can find it easier.

Regards,
Martin
Nov 13 '08 #20

P: n/a
* "Martin v. Löwis" (Thu, 13 Nov 2008 20:58:35 +0100)
If you think making a distinction between the SQLite package and the
libsqlite package is pedantic - I don't have a problem with that.

I think that is not only pedantic - it is also inaccurate. There is
no SQLite package, nor is there a libsqlite package, in the bigger+
world.
[..]
So there is no SQLite download, nor is there a libsqlite download.

I don't know what specific packages you are talking about - probably
about the way your Linux distribution choses to package things.
Some Distributions (for example SUSE) have a package called libsqlite
[1].
Fact is that none of the packages are required for using sqlite3
with Python - they are only required when you want to compile Python
yourself or when Python uses the shared library.

So the shared library *is* required (as that is the typical way in
which SQLite is built)
,--- * [2]
| 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.
`---
And even if you want to compile Python yourself, SQLite doesn't have
to be _installed_. You simply can dump the files wherever you like
and point Python to it. This is often necessary on a machine where
you cannot install anything to the default locations because you
don't have admin rights.

And that is nit-picking.
No, it's not. That was my advice for people here who wanted to build
Python with SQLite support but claimed not having rights to install it.
Obviously...
You don't have to do the "make install" step, but I would suggest to
do that, anyway, even on a machine where you don't have admin rights.
You just pass --prefix to the configure of the amalgamated sources.
This puts sqlite nicely into bin, include, and lib directories, so
that Python's setup.py can find it easier.
....this advice is even much better (but I didn't think of it).

Thorsten
[1] http://software.opensuse.org/search?q=libsqlite
[2] http://groups.google.com/group/comp....7ec003e4d3ea42
Nov 13 '08 #21

This discussion thread is closed

Replies have been disabled for this discussion.