When I've run into similar situations on Ubuntu the resolution was to 
install the package using sudo.  If you just pip installed the package 
under your user then I believe it is stored in 
.local/lib/python3.x/site-packages in the user home directory.

This would explain why it works when you run it interactively.  What user 
is running your uwsgi process?  

Also, if possible I'd move to a newer version of python3.  Python 3.6 is 
end-of-life as of 12/23/2021

-Jim


On Thursday, March 31, 2022 at 6:24:32 AM UTC-5 [email protected] wrote:

> Hi,
>
> Trying to setup web2py, python3 centos 7, nginx, uwsgi.
>
> The application is already running on centos 7 with python 2.7.
>
> With python 3.6 I get the following error:
>
> class 'RuntimeError'> Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 514, in 
> __init__
>     self._adapter = adapter(**kwargs)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
> 28, in __call__
>     return AdapterMeta.__call__(cls, *args, **kwargs)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
> 41, in __call__
>     obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
> 67, in __init__
>     after_connection,
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 424, 
> in __init__
>     super(SQLAdapter, self).__init__(*args, **kwargs)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 85, 
> in __init__
>     self.find_driver()
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 134, 
> in find_driver
>     "No driver of supported ones %s is available" % str(self.drivers)
> RuntimeError: No driver of supported ones ('psycopg2',) is available
>
> This only occurs when running the application through uwsgi, but not when 
> I run the web2py application directly through:
> *> python3 web2py.py*
>
> I also tried importing psycopg2 in the welcome app and got the following 
> error:
>   File "/opt/web2py/gluon/custom_import.py", line 78, in custom_importer
>     result = sys.modules[modules_prefix]
> KeyError: 'applications.welcome.modules.psycopg2'
>
> *Any clue as to what might be the problem? Apparently python is unable to 
> locate the psycopg2 app when ran via uwsgi.*
>
> *I'm not sure if this is enough information or what other details I should 
> provide.*
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/475524be-428d-4c50-93c8-9b368bb9afdan%40googlegroups.com.

Reply via email to