pnnl / UUDEX

UUDEX: Universal Utility Data Exchange
Other
0 stars 1 forks source link

cannot import name 'declarative_base' from 'sqlalchemy.orm' #1

Open msmith171 opened 6 months ago

msmith171 commented 6 months ago

I am attempting to run the UUDEX server on a Ubuntu Server 22.04.4, but i keep getting the error below related to the sqlalchemy dependency.

I have tried to update sqlalchemy package and that just caused there to be a different set of errors. Next i tried to force the version of casbin-sqlalchemy-adapter to be 0.4.0, but that caused there to also be a different set of errors. I also tried to run the server on Ubuntu 18.04 and 20.04 and got the same errors.

server_err.out

[2024-04-04 16:46:58 +0000] [1691] [DEBUG] Current configuration:
  config: gunicorn_direct.conf.py
  wsgi_app: None
  bind: ['0.0.0.0:3546']
  backlog: 2048
  workers: 1
  worker_class: server_handlers.gunicorn_handler.CustomWorker
  threads: 1
  worker_connections: 1000
  max_requests: 0
  max_requests_jitter: 0
  timeout: 30
  graceful_timeout: 30
  keepalive: 2
  limit_request_line: 4094
  limit_request_fields: 100
  limit_request_field_size: 8190
  reload: False
  reload_engine: auto
  reload_extra_files: []
  spew: False
  check_config: False
  print_config: False
  preload_app: False
  sendfile: None
  reuse_port: False
  chdir: /apps/uudex
  daemon: False
  raw_env: []
  pidfile: None
  worker_tmp_dir: None
  user: 0
  group: 0
  umask: 0
  initgroups: False
  tmp_upload_dir: None
  secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
  forwarded_allow_ips: ['127.0.0.1']
  accesslog: None
  disable_redirect_access_to_syslog: False
  access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
  errorlog: -
  loglevel: debug
  capture_output: False
  logger_class: gunicorn.glogging.Logger
  logconfig: None
  logconfig_dict: {}
  logconfig_json: None
  syslog_addr: udp://localhost:514
  syslog: False
  syslog_prefix: None
  syslog_facility: user
  enable_stdio_inheritance: False
  statsd_host: None
  dogstatsd_tags: 
  statsd_prefix: 
  proc_name: None
  default_proc_name: gunicorn_start
  pythonpath: None
  paste: None
  on_starting: <function OnStarting.on_starting at 0x7f73d45d3640>
  on_reload: <function OnReload.on_reload at 0x7f73d45d3760>
  when_ready: <function WhenReady.when_ready at 0x7f73d45d3880>
  pre_fork: <function Prefork.pre_fork at 0x7f73d45d39a0>
  post_fork: <function Postfork.post_fork at 0x7f73d45d3ac0>
  post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f73d45d3be0>
  worker_int: <function WorkerInt.worker_int at 0x7f73d45d3d00>
  worker_abort: <function WorkerAbort.worker_abort at 0x7f73d45d3e20>
  pre_exec: <function PreExec.pre_exec at 0x7f73d45d3f40>
  pre_request: <function PreRequest.pre_request at 0x7f73d45f80d0>
  post_request: <function PostRequest.post_request at 0x7f73d45f8160>
  child_exit: <function ChildExit.child_exit at 0x7f73d45f8280>
  worker_exit: <function WorkerExit.worker_exit at 0x7f73d45f83a0>
  nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f73d45f84c0>
  on_exit: <function OnExit.on_exit at 0x7f73d45f85e0>
  ssl_context: <function NewSSLContext.ssl_context at 0x7f73d45f8700>
  proxy_protocol: False
  proxy_allow_ips: ['127.0.0.1']
  keyfile: /apps/uudex/ssl/server.key
  certfile: /apps/uudex/ssl/server.crt
  ssl_version: 2
  cert_reqs: 2
  ca_certs: /apps/uudex/ssl/ca.pem
  suppress_ragged_eofs: True
  do_handshake_on_connect: True
  ciphers: None
  raw_paste_global_conf: []
  strip_header_spaces: False
[2024-04-04 16:46:58 +0000] [1691] [INFO] Starting gunicorn 21.2.0
[2024-04-04 16:46:58 +0000] [1691] [DEBUG] Arbiter booted
[2024-04-04 16:46:58 +0000] [1691] [INFO] Listening at: https://0.0.0.0:3546 (1691)
[2024-04-04 16:46:58 +0000] [1691] [INFO] Using worker: server_handlers.gunicorn_handler.CustomWorker
[2024-04-04 16:46:58 +0000] [1692] [INFO] Booting worker with pid: 1692
[2024-04-04 16:46:58 +0000] [1691] [DEBUG] 1 workers
[2024-04-04 16:46:58 +0000] [1692] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/apps/uudex/lib/python3.10/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/apps/uudex/gunicorn_start.py", line 37, in <module>
    from app import app as application
  File "/apps/uudex/app.py", line 57, in <module>
    import api
  File "/apps/uudex/api/__init__.py", line 40, in <module>
    from api import participant_api, subject_policy_api, subject_api, subscription_api
  File "/apps/uudex/api/participant_api.py", line 40, in <module>
    from api import base
  File "/apps/uudex/api/base.py", line 44, in <module>
    from services import authentication_service
  File "/apps/uudex/services/authentication_service.py", line 47, in <module>
    from services import authorization_service
  File "/apps/uudex/services/authorization_service.py", line 41, in <module>
    import casbin_sqlalchemy_adapter
  File "/apps/uudex/lib/python3.10/site-packages/casbin_sqlalchemy_adapter/__init__.py", line 1, in <module>
    from .adapter import CasbinRule, Adapter, Base
  File "/apps/uudex/lib/python3.10/site-packages/casbin_sqlalchemy_adapter/adapter.py", line 11, in <module>
    from sqlalchemy.orm import declarative_base
ImportError: cannot import name 'declarative_base' from 'sqlalchemy.orm' (/apps/uudex/lib/python3.10/site-packages/sqlalchemy/orm/__init__.py)
[2024-04-04 16:46:58 +0000] [1692] [INFO] Worker exiting (pid: 1692)
[2024-04-04 16:46:58 +0000] [1691] [ERROR] Worker (pid:1692) exited with code 3
[2024-04-04 16:46:58 +0000] [1691] [ERROR] Shutting down: Master
[2024-04-04 16:46:58 +0000] [1691] [ERROR] Reason: Worker failed to boot.
craig8 commented 4 months ago

@msmith171 sorry for not seeing this before now. I am now the code owner for this repository. I have been working behind the scenes updating this to a fastapi/sqlmodel base so it won't use declarative_base as an endpoint. I will be pushing somethings out in the coming weeks. I hope this will help you out!