jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.03k stars 339 forks source link

tljh hub breaks with SQLalchemy 2.0.0 #847

Closed pnasrat closed 1 year ago

pnasrat commented 1 year ago

Bug description

Hub fails to start on developer builds post release of SQLAlchemy 2.0.0.

Reported via https://discourse.jupyter.org/t/tljh-failure-setting-up-development-environment-failed-to-start-jupyterhub-service/17748

Expected behaviour

Running local tljh instance

Actual behaviour

Fails to start with traceback in journalctl logs

How to reproduce

  1. Follow TLJH Development Environment as described here: https://tljh.jupyter.org/en/latest/contributing/dev-setup.htm
Logs ``` Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.650 JupyterHub app:2480] Running JupyterHub version 1.5.1 Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.650 JupyterHub app:2510] Using Authenticator: firstuseauthenticator.firstuseauthenticator.FirstUseAuthenticator Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.650 JupyterHub app:2510] Using Spawner: traitlets.traitlets.UserCreatingSpawner-5.9.0 Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.650 JupyterHub app:2510] Using Proxy: jupyterhub_traefik_proxy.toml.TraefikTomlProxy-0+unknown Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.660 JupyterHub app:1554] Loading cookie_secret from /opt/tljh/state/jupyterhub_cookie_secret Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.735 alembic.runtime.migration migration:205] Context impl SQLiteImpl. Jan 30 15:05:51 1a4911f9df26 python3[2771]: [I 2023-01-30 15:05:51.735 alembic.runtime.migration migration:208] Will assume non-transactional DDL. Jan 30 15:05:51 1a4911f9df26 python3[2771]: [E 2023-01-30 15:05:51.744 JupyterHub app:2991] Jan 30 15:05:51 1a4911f9df26 python3[2771]: Traceback (most recent call last): Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/app.py", line 2988, in launch_instance_async Jan 30 15:05:51 1a4911f9df26 python3[2771]: await self.initialize(argv) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/app.py", line 2522, in initialize Jan 30 15:05:51 1a4911f9df26 python3[2771]: self.init_db() Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/app.py", line 1726, in init_db Jan 30 15:05:51 1a4911f9df26 python3[2771]: self.session_factory = orm.new_session_factory( Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/orm.py", line 880, in new_session_factory Jan 30 15:05:51 1a4911f9df26 python3[2771]: check_db_revision(engine) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/orm.py", line 771, in check_db_revision Jan 30 15:05:51 1a4911f9df26 python3[2771]: current_table_names = set(inspect(engine).get_table_names()) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/inspection.py", line 111, in inspect Jan 30 15:05:51 1a4911f9df26 python3[2771]: ret = reg(subject) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 304, in _engine_insp Jan 30 15:05:51 1a4911f9df26 python3[2771]: return Inspector._construct(Inspector._init_engine, bind) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 237, in _construct Jan 30 15:05:51 1a4911f9df26 python3[2771]: init(self, bind) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 248, in _init_engine Jan 30 15:05:51 1a4911f9df26 python3[2771]: engine.connect().close() Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3245, in connect Jan 30 15:05:51 1a4911f9df26 python3[2771]: return self._connection_cls(self) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 174, in __init__ Jan 30 15:05:51 1a4911f9df26 python3[2771]: self.dispatch.engine_connect(self) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/event/attr.py", line 487, in __call__ Jan 30 15:05:51 1a4911f9df26 python3[2771]: fn(*args, **kw) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/event/legacy.py", line 100, in wrap_leg Jan 30 15:05:51 1a4911f9df26 python3[2771]: return fn(*conv(*args)) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/jupyterhub/orm.py", line 737, in ping_connection Jan 30 15:05:51 1a4911f9df26 python3[2771]: connection.scalar(select([1])) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/_selectable_constructors.py", line 493, in select Jan 30 15:05:51 1a4911f9df26 python3[2771]: return Select(*entities) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/selectable.py", line 5219, in __init__ Jan 30 15:05:51 1a4911f9df26 python3[2771]: self._raw_columns = [ Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/selectable.py", line 5220, in Jan 30 15:05:51 1a4911f9df26 python3[2771]: coercions.expect( Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 413, in expect Jan 30 15:05:51 1a4911f9df26 python3[2771]: resolved = impl._literal_coercion( Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 652, in _literal_coercion Jan 30 15:05:51 1a4911f9df26 python3[2771]: self._raise_for_expected(element, argname) Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 1143, in _raise_for_expected Jan 30 15:05:51 1a4911f9df26 python3[2771]: return super()._raise_for_expected( Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 711, in _raise_for_expected Jan 30 15:05:51 1a4911f9df26 python3[2771]: super()._raise_for_expected( Jan 30 15:05:51 1a4911f9df26 python3[2771]: File "/opt/tljh/hub/lib/python3.8/site-packages/sqlalchemy/sql/coercions.py", line 536, in _raise_for_expected Jan 30 15:05:51 1a4911f9df26 python3[2771]: raise exc.ArgumentError(msg, code=code) from err Jan 30 15:05:51 1a4911f9df26 python3[2771]: sqlalchemy.exc.ArgumentError: Column expression, FROM clause, or other columns clause element expected, got [1]. Did you mean to say select(1)? Jan 30 15:05:51 1a4911f9df26 python3[2771]: ```
welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

pnasrat commented 1 year ago

Note upstream jupyterhub has fixed in jupyterhub/jupyterhub#4312 but as tljh uses jupyterhub 1.5.1 the installer probably needs to ensure 1.x SQLAlchemy is installed

jrdnbradford commented 1 year ago

Looks like this issue is the same problem I encountered in #846. See that issue for some extra logs and discussion.

pnasrat commented 1 year ago

Closed as duplicate. Sorry I searched for SQLAlchemy but for some reason didn't see that issue.