got the answer from support Hi António, if you need psycopg2 then please install it like this:
export PATH=/usr/pgsql-11/bin/:$PATH cd ~/apps/fileit source env/bin/activate pip install psycopg2 -- Sean from (((Opalstack It worked for me .... thank you Em seg., 19 de out. de 2020 às 20:03, Jose C <[email protected]> escreveu: > I'm also on opal5 using postgres but still on web2py 2.18.5 (can't upgrade > due to unresolved redis session issue). > > I suspect you have a library version problem. > > You're using the default system-wide python3 install, which is using > psycopg2 version 2.7.7. (Run psycopg2.__version__ at the command line > after importing). > > The highly recommended way to do this (to avoid conflicts and maintain > your sanity) is to create yourself a virtual environment for your web2py > app. Then pip install psycopg2-binary (plus whatever other packages you > need for that app) which installs version 2.8.4 of the psycopg2 library. > > Using this combo you should have no issues. > > HTH, > > > > > > > > On Monday, 19 October 2020 16:56:05 UTC+1, Ramos wrote: >> >> hello i´m starting my journey on Opalstack and my app cant connect to the >> postgresql db >> >> db = DAL('postgres://user:pwdXru@localhost:5432/database', >> >> the previous line does not work. I checked that psycopg2 is available in >> python command line >> [image: image.png] >> >> <class 'RuntimeError'> Failure to connect, tried 5 times: Traceback (most >> recent call last): File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/base.py", line >> 507, in __init__ self._adapter = adapter(**kwargs) File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/postgres.py", >> line 28, in __call__ return AdapterMeta.__call__(cls, *args, **kwargs) File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/__init__.py", >> line 41, in __call__ obj = super(AdapterMeta, cls).__call__(*args, >> **kwargs) File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/postgres.py", >> line 67, in __init__ after_connection, File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 417, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 85, in __init__ self.find_driver() File >> "/home/ramos/apps/fileit/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 availableVersão >> web2py™ Version 2.20.4-stable+timestamp.2020.05.03.05.18.50Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> 17. >> 18. >> 19. >> 20. >> 21. >> 22. >> 23. >> 24. >> 25. >> 26. >> 27. >> 28. >> >> Traceback (most recent call last): >> File "/home/ramos/apps/fileit/web2py/gluon/restricted.py", line 219, in >> restricted >> exec(ccode, environment) >> File "/home/ramos/apps/fileit/web2py/applications/fileit/models/db1.py" >> <https://cires.opalstacked.com/admin/default/edit/fileit/models/db1.py>, >> line 34, in <module> >> check_reserved=['mysql', 'postgres']) # ['all']) >> File "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/base.py", >> line 209, in __call__ >> obj = super(MetaDAL, cls).__call__(*args, **kwargs) >> File "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/base.py", >> line 526, in __init__ >> "Failure to connect, tried %d times:\n%s" % (attempts, tb) >> RuntimeError: Failure to connect, tried 5 times: >> Traceback (most recent call last): >> File "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/base.py", >> line 507, in __init__ >> self._adapter = adapter(**kwargs) >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/postgres.py", >> line 28, in __call__ >> return AdapterMeta.__call__(cls, *args, **kwargs) >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/__init__.py", >> line 41, in __call__ >> obj = super(AdapterMeta, cls).__call__(*args, **kwargs) >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/postgres.py", >> line 67, in __init__ >> after_connection, >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 417, in __init__ >> super(SQLAdapter, self).__init__(*args, **kwargs) >> File >> "/home/ramos/apps/fileit/web2py/gluon/packages/dal/pydal/adapters/base.py", >> line 85, in __init__ >> self.find_driver() >> File >> "/home/ramos/apps/fileit/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 >> >> >> -- > 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/8ef9403c-b1e5-4d15-b638-360cfcf3095eo%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/8ef9403c-b1e5-4d15-b638-360cfcf3095eo%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEM0BxOC1QXBkD7vGNnvgH-YJwKvjUp%2BGXhptwZbnHKZWk1Fuw%40mail.gmail.com.

