no driver available ('sqlite2', 'sqlite3')

851 views
Skip to first unread message

Martin Weissenboeck

unread,
Aug 5, 2013, 11:39:50 AM8/5/13
to web...@googlegroups.com
I have made a new web2py installation on Ubuntu, using the script setup-web2py-ubuntu.sh
web2py can be opened and admin shows:

Version

2.5.1-stable+timestamp.2013.06.06.15.39.19
(L?uft auf Apache/2.2.22 (Ubuntu))


When I try to open the "Welcome" application I get:

Error ticket for "welcome"

Ticket ID

178.190.67.157.2013-08-05.17-24-49.9c9dbd34-b526-41aa-a6f2-b56eabf219df

<type 'exceptions.RuntimeError'> Failure to connect, tried 5 times: Traceback (most recent call last): File "/home/www-data/web2py/gluon/dal.py", line 7413, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File "/home/www-data/web2py/gluon/dal.py", line 2192, in __init__ if do_connect: self.find_driver(adapter_args) File "/home/www-data/web2py/gluon/dal.py", line 733, in find_driver raise RuntimeError("no driver available %s" % str(self.drivers)) RuntimeError: no driver available ('sqlite2', 'sqlite3')

Version

web2py™Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
PythonPython 2.7.4: /usr/local/bin/python (prefix: /usr/local)

I have tried to use sqlite from Python:

Python 2.7.5 (default, Aug  5 2013, 06:36:44)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> print sqlite3.version
2.6.0
>>> print sqlite3.sqlite_version
3.7.15.2

Seems to be ok.

Now I have tried to open an interactive console:

root@mw:/home/www-data/web2py# python web2py.py -M -S welcome
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)
WARNING:web2py:import IPython error; use default python shell
Python 2.7.5 (default, Aug  5 2013, 06:36:44)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> db=DAL("sqlite://storage.sqlite")
>>> db.tables
[]
>>> db.define_table("test", Field("x"))
<Table test (id,x)>
>>> db.tables
['test']
>>>

Looks good, but this table will not be saved. After closing and opening the table list is empty again.

Any ideas?
Do I need both sqlite2 and sqlite3?

Regards, Martin

Massimo Di Pierro

unread,
Aug 5, 2013, 12:17:56 PM8/5/13
to web...@googlegroups.com, mar...@weissenboeck.at
db.commit()

Richard Vézina

unread,
Aug 5, 2013, 12:18:09 PM8/5/13
to web2py-users
Here what DAL try to import

from pysqlite2 import dbapi2 as sqlite2
from sqlite3 import dbapi2 as sqlite3


--
 
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Martin Weissenboeck

unread,
Aug 5, 2013, 12:33:36 PM8/5/13
to web...@googlegroups.com
ok. but the interactive console was only for testing.
why does "welcome" not work? it's a new, clean installation.
i am working since some hours, but i did not find an answer.


2013/8/5 Massimo Di Pierro <massimo....@gmail.com>
--

Richard Vézina

unread,
Aug 5, 2013, 1:04:07 PM8/5/13
to web2py-users
My guess is that the script haven't been review for a wild and there is package (python package) missing... Maybe packages avec change name or something so the script can't install them...

The error you have says you miss adapter for sqlite...

You can search the dal with "no driver available" you will be able to locate where this error is trigger and maybe read the code find what trigger it...

I don't have time to do it carefully.

The pasted import lines above seems to be what web2py do to set sqlite adapter...

Hope it help.

Richard

Massimo Di Pierro

unread,
Aug 5, 2013, 1:29:16 PM8/5/13
to web...@googlegroups.com, mar...@weissenboeck.at
Is it possible apache is using a different python version (one has sqlite and one no)?

Alan Etkin

unread,
Aug 5, 2013, 2:01:03 PM8/5/13
to web...@googlegroups.com, mar...@weissenboeck.at
Is it possible apache is using a different python version (one has sqlite and one no)?

The script installs python 2.5 with apt-get, but I suppose it should ship sqlite also. I guess you could try commenting the installation of python in the script to use the current interpreter.

Martin Weissenboeck

unread,
Aug 5, 2013, 2:28:50 PM8/5/13
to web...@googlegroups.com
You are right, there are two different Python versions, but both are in /usr/local/bin:

The error ticket contains these lines:


Version

web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
Python Python 2.7.4: /usr/local/bin/python (prefix: /usr/local)

But calling Python from the command line gives:


mweissen@mweissen:/$ /usr/local/bin/python

Python 2.7.5 (default, Aug  5 2013, 06:36:44)
[GCC 4.7.3] on linux2

Sorry - I do not understand this behavior!
Which line of code starts the Python interpreter of web2py when using Apache?

Martin Weissenboeck

unread,
Aug 5, 2013, 2:42:58 PM8/5/13
to web...@googlegroups.com
Interesting. But web2py reports Python version 2.7.4 and not 2.5.
If I start web2py without Apache, it works without problems. So: where is the Python interpreter which is used by Apache?


2013/8/5 Alan Etkin <spam...@gmail.com>
Is it possible apache is using a different python version (one has sqlite and one no)?

The script installs python 2.5 with apt-get, but I suppose it should ship sqlite also. I guess you could try commenting the installation of python in the script to use the current interpreter.

Jonathan Lundell

unread,
Aug 5, 2013, 2:48:20 PM8/5/13
to web...@googlegroups.com
On 5 Aug 2013, at 11:42 AM, Martin Weissenboeck <mwei...@gmail.com> wrote:
Interesting. But web2py reports Python version 2.7.4 and not 2.5. 
If I start web2py without Apache, it works without problems. So: where is the Python interpreter which is used by Apache?

FWIW, it's wsgi, not Apache, that cares about Python.

Also, according to the Python docs, sqlite3 was built in beginning with 2.5, so it's still an odd problem.

web2py reports Python 2.7 when running under Apache?

Alan Etkin

unread,
Aug 5, 2013, 2:57:41 PM8/5/13
to web...@googlegroups.com
> FWIW, it's wsgi, not Apache, that cares about Python.

Also, according to the Python docs, sqlite3 was built in beginning with 2.5, so it's still an odd problem.

web2py reports Python 2.7 when running under Apache?

Perhaps it is possible to force the python interpreter by adding manually the path to Python in the apache configuration file

http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonHome

Martin Weissenboeck

unread,
Aug 5, 2013, 3:09:51 PM8/5/13
to web...@googlegroups.com
Yes. This is the error ticket:

Version

web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
Python Python 2.7.4: /usr/local/bin/python (prefix: /usr/local)



2013/8/5 Jonathan Lundell <jlun...@pobox.com>

Jonathan Lundell

unread,
Aug 5, 2013, 3:11:26 PM8/5/13
to web...@googlegroups.com
Though IIRC, web2py's Ubuntu setup script uses uwsgi.

Niphlod

unread,
Aug 5, 2013, 3:18:38 PM8/5/13
to web...@googlegroups.com
there are 2, one "historic" that install apache+postgresql+web2py+postfix+mercurial that has not been updated in a lot (setup-web2py-ubuntu.sh), and one "modern" (ubuntu >= 12.04 is required) that installs nginx+uwsgi

Jonathan Lundell

unread,
Aug 5, 2013, 3:36:10 PM8/5/13
to web...@googlegroups.com
On 5 Aug 2013, at 12:09 PM, Martin Weissenboeck <mwei...@gmail.com> wrote:
Yes. This is the error ticket:

Version

web2py™Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
PythonPython 2.7.4: /usr/local/bin/python (prefix: /usr/local)


I think I might see the problem. Can you try hacking dal.py? Find the line:

        from sqlite3 import dbapi2 as sqlite3

change it to

        import sqlite3

and see if that works.

Martin Weissenboeck

unread,
Aug 5, 2013, 4:04:50 PM8/5/13
to web...@googlegroups.com
Now I have tried to install nginx, using the script
setup-web2py-nginx-uwsgi-ubuntu.sh

The installations runs to the end. And now I get:

502 Bad Gateway


nginx/1.2.6 (Ubuntu)




2013/8/5 Niphlod <nip...@gmail.com>
there are 2, one "historic" that install apache+postgresql+web2py+postfix+mercurial that has not been updated in a lot (setup-web2py-ubuntu.sh), and one "modern" (ubuntu >= 12.04 is required) that installs nginx+uwsgi

--

Richard Vézina

unread,
Aug 5, 2013, 4:08:37 PM8/5/13
to web2py-users
try start uwsgi-emperor 

Maybe check uwsgi is properly install... I had issue in the pass the script skip install uwsgi... But first just try to start the service...

uwsgi is installed in emperor mode so the service is not start and stop as usual with ubuntu.

Richartd

Alan Etkin

unread,
Aug 5, 2013, 4:16:01 PM8/5/13
to web...@googlegroups.com, mar...@weissenboeck.at
> 502 Bad Gateway

Also check that the user who runs the script and/or nginx has read write and execute access to the web2py files

Martin Weissenboeck

unread,
Aug 5, 2013, 4:16:19 PM8/5/13
to web...@googlegroups.com
Sorry, this is the result:

Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.




2013/8/5 Jonathan Lundell <jlun...@pobox.com>
On 5 Aug 2013, at 12:09 PM, Martin Weissenboeck <mwei...@gmail.com> wrote:
Yes. This is the error ticket:

Version

web2py™Version 2.5.1-stable+timestamp.2013.06.06.15.39.19
PythonPython 2.7.4: /usr/local/bin/python (prefix: /usr/local)


I think I might see the problem. Can you try hacking dal.py? Find the line:

        from sqlite3 import dbapi2 as sqlite3

change it to

        import sqlite3

and see if that works.


2013/8/5 Jonathan Lundell <jlun...@pobox.com>
On 5 Aug 2013, at 11:42 AM, Martin Weissenboeck <mwei...@gmail.com> wrote:
Interesting. But web2py reports Python version 2.7.4 and not 2.5. 
If I start web2py without Apache, it works without problems. So: where is the Python interpreter which is used by Apache?

FWIW, it's wsgi, not Apache, that cares about Python.

Also, according to the Python docs, sqlite3 was built in beginning with 2.5, so it's still an odd problem.

web2py reports Python 2.7 when running under Apache?



2013/8/5 Alan Etkin <spam...@gmail.com>
Is it possible apache is using a different python version (one has sqlite and one no)?

The script installs python 2.5 with apt-get, but I suppose it should ship sqlite also. I guess you could try commenting the installation of python in the script to use the current interpreter.


Martin Weissenboeck

unread,
Aug 5, 2013, 4:17:40 PM8/5/13
to web...@googlegroups.com
Last message is the result of patching dal.py


2013/8/5 Martin Weissenboeck <mwei...@gmail.com>

Jonathan Lundell

unread,
Aug 5, 2013, 4:26:53 PM8/5/13
to web...@googlegroups.com
On 5 Aug 2013, at 1:16 PM, Martin Weissenboeck <mwei...@gmail.com> wrote:
Sorry, this is the result:

Odd. OK, never mind.

Alan Etkin

unread,
Aug 5, 2013, 4:57:27 PM8/5/13
to web...@googlegroups.com, mar...@weissenboeck.at
To check for errors look for

/var/log/uwsgi.log
/var/log/nginx/

I have solved a similar problem with centos by giving the users running nginx and uwsgi access rights to the web2py folder and its subfolders

Martin Weissenboeck

unread,
Aug 6, 2013, 1:23:34 AM8/6/13
to web...@googlegroups.com
A big "Thanks" to all!
Let me tell the end of the story:

(1) I could not start the nginx-version. Maybe there is a problem with the script? At the moment I have not enough time to test the script with a new (virtual) machine.

(2) I cannot understand, why the error ticket reports

Python Python 2.7.4: /usr/local/bin/python (prefix: /usr/local)
and starting /usr/local/bin/python from the command line reports version 2.7.5

(3) I have deleted the whole Python 2.7.4 package and afterwards I have reinstalled it. Now web2py runs as expected.

(4) The whole trouble started with the idea to use Python 2.7.5 instead of Python 2.7.5. But 2.7.5 cannot be installed with Ubuntus apt-get and my tries to install 2.7.5 by hand went wrong.

(5) "Never change a running system!"

Ragrads, Martin

2013/8/5 Alan Etkin <spam...@gmail.com>

--

Niphlod

unread,
Aug 6, 2013, 8:02:22 AM8/6/13
to web...@googlegroups.com, mar...@weissenboeck.at
the "modern" script was tested with 12.04 and 12.10. I'm downloading the 13.04 to see if there is any adjustments to make.

Niphlod

unread,
Aug 6, 2013, 9:57:48 AM8/6/13
to web...@googlegroups.com, mar...@weissenboeck.at
tested also on ubuntu server 13.04 64 bit: no issues at all.
once logged in in the freshly-installed server, all I had to do was:

wget https://raw.github.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
sudo bash setup-web2py-nginx-uwsgi-ubuntu.sh

then right at the end of the process, filling the details about the SSL certificate.
All was ready and fine.

Martin Weissenboeck

unread,
Aug 6, 2013, 1:30:36 PM8/6/13
to web...@googlegroups.com
Thank you, I'll try it again...


2013/8/6 Niphlod <nip...@gmail.com>
--
Reply all
Reply to author
Forward
0 new messages