Re: PGadmi4 - Unable to set up dev environment - Mailing list pgadmin-hackers

From Vaij Bharamshetty
Subject Re: PGadmi4 - Unable to set up dev environment
Date
Msg-id CAOHTSrqEMdAAi3uWpRFgd=x6BdTLLKG3yz0yjWydpuNSdDJgMg@mail.gmail.com
Whole thread Raw
In response to Re: PGadmi4 - Unable to set up dev environment  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Responses Re: PGadmi4 - Unable to set up dev environment  (Vaij Bharamshetty <vaijrb@gmail.com>)
List pgadmin-hackers
Hi Aditya.

I am using requirements.txt within the pgadmin4 directory. Attaching here for your reference.

Vaij


On Wed, Feb 8, 2023 at 1:47 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Vaij,

Which requirements are you installing? If you're installing the correct one then you will not face any issue. I have already shared the requirements, it has Flask-SocketIO as well.

On Wed, Feb 8, 2023 at 10:46 AM Vaij Bharamshetty <vaijrb@gmail.com> wrote:
Hi Aditya,

Would it be possible to assist me in real time by sharing my screen? I got a module not found for "Flask-SocketIO" and a few others, and after installing them looks like many others are getting updated hence their versions are different than in requirement.txt.

Thank you,

Vaij



On Tue, Feb 7, 2023 at 1:22 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Vaij,

I am not sure from where are you getting the incorrect versions required but you're using - Flask-SQLAlchemy==3.0.3 but pgAdmin requirements clearly has - Flask-SQLAlchemy==2.5.*
I suggest, deleting the venv completely and reinstalling using pgAdmin requirements.txt

On Tue, Feb 7, 2023 at 11:46 AM Vaij Bharamshetty <vaijrb@gmail.com> wrote:
Thank you Aditya. 

I tried creating from the pgadmin4 directory, but now I get a different error message.

(venv) [vaij@rocky4 pgadmin4]$ python3 $PGADMIN4_SRC/web/setup.py
Traceback (most recent call last):
  File "/home/vaij/pgadmin4/web/setup.py", line 24, in <module>
    import config
  File "/home/vaij/pgadmin4/web/config.py", line 25, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/home/vaij/pgadmin4/web/pgadmin/__init__.py", line 39, in <module>
    from pgadmin.model import db, Role, Server, SharedServer, ServerGroup, \
  File "/home/vaij/pgadmin4/web/pgadmin/model/__init__.py", line 22, in <module>
    from flask_sqlalchemy import SQLAlchemy
  File "/home/vaij/pgadmin4/venv/lib64/python3.9/site-packages/flask_sqlalchemy/__init__.py", line 5, in <module>
    from .extension import SQLAlchemy
  File "/home/vaij/pgadmin4/venv/lib64/python3.9/site-packages/flask_sqlalchemy/extension.py", line 22, in <module>
    from .session import _app_ctx_id
  File "/home/vaij/pgadmin4/venv/lib64/python3.9/site-packages/flask_sqlalchemy/session.py", line 8, in <module>
    from flask.globals import app_ctx
ImportError: cannot import name 'app_ctx' from 'flask.globals' (/home/vaij/pgadmin4/venv/lib64/python3.9/site-packages/flask/globals.py)


-- Working from $PGADMIN4_SRC directory
(venv) [vaij@rocky4 pgadmin4]$ pwd
/home/vaij/pgadmin4

Attaching pip freeze for reference.

Vaij



On Tue, Feb 7, 2023 at 12:35 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Vaij,

You're using requirements.txt from the runtime directory. There is no such file in the runtime directory.
The correct requirements.txt reside in the pgadmin home directory which has below content. Please create the venv using the correct requirements.txt file.

Flask==2.0.3; python_version <= '3.6'
Flask==2.1.*; python_version >= '3.7'
Flask-Gravatar==0.*
Flask-Login==0.*
Flask-Mail==0.*
Flask-Migrate==4.*
dnspython==2.2.1
greenlet==1.1.2; python_version <= '3.10'
Flask-SQLAlchemy==2.5.*
Flask-WTF==1.0.1
Flask-Compress==1.*
Flask-Paranoid==0.*
Flask-Babel==2.*
Flask-Security-Too==4.1.*
Flask-SocketIO<=5.2.0
WTForms==3.*
passlib==1.*
pytz==2021.*
simplejson==3.*
speaklater3==1.*
sqlparse==0.*
psutil==5.9.3
psycopg2==2.9.*
python-dateutil==2.*
SQLAlchemy==1.4.44; python_version <= '3.6'
SQLAlchemy==1.4.*; python_version >= '3.7'
bcrypt==3.*
cryptography==3.*
sshtunnel==0.*
ldap3==2.*
gssapi==1.7.*; python_version <= '3.6'
gssapi==1.8.*; python_version >= '3.7'
eventlet==0.33.0
httpagentparser==1.9.*
user-agents==2.2.0
pywinpty==1.1.*; sys_platform=="win32"
Authlib==0.15.*; python_version <= '3.6'
Authlib==1.1.*; python_version >= '3.7'
requests==2.25.*
pyotp==2.*
qrcode==7.*
Pillow==8.4.*; python_version <= '3.6'
Pillow==9.*; python_version >= '3.7'
boto3==1.23.*; python_version <= '3.6'
boto3==1.26.*; python_version >= '3.7'
botocore==1.26.*; python_version <= '3.6'
botocore==1.29.*; python_version >= '3.7'
urllib3==1.26.*
Werkzeug==2.0.3; python_version <= '3.6'
Werkzeug==2.1.2; python_version >= '3.7'
azure-mgmt-rdbms==10.1.0
azure-mgmt-resource==21.0.0
azure-mgmt-subscription==3.0.0
azure-identity==1.9.0


On Tue, Feb 7, 2023 at 12:07 AM Vaij Bharamshetty <vaijrb@gmail.com> wrote:
Thank you Aditya, appreciate your help. I still face issues detailed as below,

-- Python Version
(venv) [vaij@rocky4 runtime]$ python -V
Python 3.9.14

-- Clean up existing Packages
pip freeze | xargs pip uninstall -y

-- Install from Requirements
(venv) [vaij@rocky4 runtime]$ pip install -r requirements.txt

-- One Package did not install
ERROR: Could not find a version that satisfies the requirement subscription-manager==1.29.30 (from versions: none)
ERROR: No matching distribution found for subscription-manager==1.29.30

-- Try running setup
(venv) [vaij@rocky4 runtime]$ python3 $PGADMIN4_SRC/web/setup.py
Traceback (most recent call last):
  File "/home/vaij/pgadmin4/web/setup.py", line 24, in <module>
    import config
  File "/home/vaij/pgadmin4/web/config.py", line 25, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/home/vaij/pgadmin4/web/pgadmin/__init__.py", line 25, in <module>
    from flask_socketio import SocketIO
ModuleNotFoundError: No module named 'flask_socketio'


-- (Trial and error) Try running with sudo
(venv) [vaij@rocky4 runtime]$ sudo python3 $PGADMIN4_SRC/web/setup.py
[sudo] password for vaij:
Traceback (most recent call last):
  File "/home/vaij/pgadmin4/web/setup.py", line 24, in <module>
    import config
  File "/home/vaij/pgadmin4/web/config.py", line 25, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/home/vaij/pgadmin4/web/pgadmin/__init__.py", line 24, in <module>
    from flask import Flask, abort, request, current_app, session, url_for
ModuleNotFoundError: No module named 'flask'


-- Check existing packages and specifically Flask Version
(venv) [vaij@rocky4 runtime]$ pip freeze > pgadmin4_packages.txt

Flask==2.1.2
flatbuffers==1.12
fonttools==4.33.3
frozenlist==1.3.0
fsspec==2022.5.0

-- Try running python3 $PGADMIN4_SRC/web/setup.py
-- Manually install packages after above is failed for the following
(venv) [vaij@rocky4 runtime]$ pip install flask_socketio
flask_babel
flask_login
flask_mail
flask_paranoid
flask_security
email_validator
flask_sqlalchemy
simplejson
flask_migrate

-- Try running python3 $PGADMIN4_SRC/web/setup.py
(venv) [vaij@rocky4 runtime]$ python3 $PGADMIN4_SRC/web/setup.py
2023-02-06 13:29:58,252: INFO   pgadmin:        ########################################################
2023-02-06 13:29:58,253: INFO   pgadmin:        Starting pgAdmin 4 v6.19...
2023-02-06 13:29:58,253: INFO   pgadmin:        ########################################################
2023-02-06 13:29:58,253: DEBUG  pgadmin:        Python syspath: ['/home/vaij/pgadmin4/web', '/usr/lib64/python39.zip', '/usr/lib64/python3.9', '/usr/lib64/python3.9/lib-dynload', '/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages', '/home/vaij/pgadmin4/runtime/venv/lib/python3.9/site-packages', '/home/vaij/.local/lib/python3.9/site-packages', '/usr/local/lib64/python3.9/site-packages', '/usr/local/lib/python3.9/site-packages', '/usr/lib64/python3.9/site-packages', '/usr/lib/python3.9/site-packages']
Traceback (most recent call last):
  File "/home/vaij/pgadmin4/web/setup.py", line 220, in <module>
    app = create_app()
  File "/home/vaij/pgadmin4/web/pgadmin/__init__.py", line 302, in create_app
    app.logger.debug('Available translations: %s' % babel.list_translations())
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/flask_babel/__init__.py", line 188, in list_translations
    for dirname in get_babel().translation_directories:
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/flask_babel/__init__.py", line 44, in get_babel
    if not hasattr(app, 'extensions'):
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/werkzeug/local.py", line 316, in __get__
    obj = instance._get_current_object()  # type: ignore[misc]
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/werkzeug/local.py", line 513, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.


Attaching pip freeze for your reference.

On Mon, Feb 6, 2023 at 1:05 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Vaij,

You're using Flask 2.2.2. But the pgAdmin requirements say:
Flask==2.0.3; python_version <= '3.6'
Flask==2.1.*; python_version >= '3.7'
Please use pgAdmin requirements.txt to create venv.


On Mon, Feb 6, 2023 at 10:57 AM Vaij Bharamshetty <vaijrb@gmail.com> wrote:
Hi Aditya,

Thank you for reaching out.  Please find the attached output.

Vaij

On Mon, Feb 6, 2023 at 12:01 AM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Vaij,

Please share pip freeze output. Looks like some issue with Flask version.

On Sun, Feb 5, 2023 at 10:00 AM Vaij Bharamshetty <vaijrb@gmail.com> wrote:
Hi team,

I am trying to set up dev. environment Rocky Linux 9. Despite repeated attempts, I am still getting the following errors and need help in fixing this.

Traceback (most recent call last):
  File "/home/vaij/pgadmin4/web/setup.py", line 24, in <module>
    import config
  File "/home/vaij/pgadmin4/web/config.py", line 25, in <module>
    from pgadmin.utils import env, IS_WIN, fs_short_path
  File "/home/vaij/pgadmin4/web/pgadmin/__init__.py", line 24, in <module>
    from flask import Flask, abort, request, current_app, session, url_for
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/home/vaij/pgadmin4/runtime/venv/lib64/python3.9/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'


Please do the needful. I would like to join as a contributor.

Thank you,

Vaij



--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"
Attachment

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: [pgadmin-org/pgadmin4] cf9486: Update copyright notices in Dockerfile and Makefil...
Next
From: "Lee, Meyer "
Date:
Subject: pgAdmin support lifecycle