jupyter / nbgrader

A system for assigning and grading notebooks
https://nbgrader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.3k stars 317 forks source link

nbgrader with Jupyterhub and Sqlalchemy not working #1796

Closed christina-seegers closed 1 year ago

christina-seegers commented 1 year ago

Operating system

?

nbgrader --version

0.8.4

jupyterhub --version (if used with JupyterHub)

2.3.1

jupyter notebook --version

none

Expected behavior

I can install nbgrader in Version 0.8.4 after installing JupyterHub 2.3.1.

Actual behavior

I get an error try to install Version 0.8.4 if I do not use Sqlalchemy 2.0 (which I can not because JupyterHub 2.x is not working with this Version 3.x does, but nbgrader does not support Version 3.x as far as I see).

Error:

[17/33] RUN jupyter nbextension install --symlink --sys-prefix --py nbgrader --overwrite:

0 0.848 Traceback (most recent call last):

0 0.848 File "/usr/local/bin/jupyter-nbextension", line 8, in

...

0 0.848 File "/usr/local/lib/python3.8/dist-packages/nbgrader/exchange/default/collect.py", line 13, in

0 0.848 from ...api import Gradebook, MissingEntry

0 0.848 File "/usr/local/lib/python3.8/dist-packages/nbgrader/api.py", line 11, in

0 0.848 from sqlalchemy.orm import (sessionmaker, scoped_session, relationship,

0 0.848 ImportError: cannot import name 'DeclarativeBase' from 'sqlalchemy.orm' (/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/init.py)

Steps to reproduce the behavior

Start with installing jupyterhub (I used a docker image: jupyterhub/jupyterhub:2.3.1) and then install nbgrader 0.8.4

If I install sqlalchemy 2.x (before nbgrader) then there is no problem installing ... but the jupyterhub crashes, since it cannot run with sqlalchemy 2.x ...

tuncbkose commented 1 year ago

I guess this means that #1788 should have bumped up the minimum version as well, DeclarativeBase change specifically is backwards-incompatible.

That said, I cannot think of why nbgrader 0.8.4 wouldn't work with some version of JupyterHub. If you could share the errors you encounter with sqlalchemy 2.x, I am happy to take a look.

I'll also be doing some Hub related things myself, so I can confirm if it is working or not, but it might take a while for me to get to it.

christina-seegers commented 1 year ago

Connecting to db is followed by this output jupyterhub | [E 2023-06-29 09:32:13.769 JupyterHub app:3297] jupyterhub | Traceback (most recent call last): jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 3294, in launch_instance_async jupyterhub | await self.initialize(argv) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 2813, in initialize jupyterhub | self.init_db() jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 1777, in init_db jupyterhub | dbutil.upgrade_if_needed(self.db_url, log=self.log) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/dbutil.py", line 112, in upgrade_if_needed jupyterhub | orm.check_db_revision(engine) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/orm.py", line 949, in check_db_revision jupyterhub | alembic_revision = engine.execute( jupyterhub | AttributeError: 'Engine' object has no attribute 'execute' jupyterhub | jupyterhub | [D 2023-06-29 09:32:13.770 JupyterHub application:1028] Exiting application: jupyterhub notebook-dev |

Informations given about jupyterhub and sqlalchemy can be found here: https://github.com/jupyterhub/dockerspawner/issues/477 or here: https://github.com/jupyterhub/dockerspawner/issues/478

As far as I see Jupyterhub 2.3.1 pinned sqlalchemy <2. My try to force sqlalchemy to version 2 lead to successful installation of nbgrader 0.8.4 but destroyed the hub.

I will try working with version 0.8.3 of nbgrader.

tuncbkose commented 1 year ago

I missed that JupyterHub requirements are written in requirements.txt and not in pyproject.toml, so I completely missed the dependency on sqlalchemy. nbgrader 0.8.3 should work then. Sorry for the trouble.

On Fri, Jun 30, 2023 at 09:12 christina-seegers @.***> wrote:

Connecting to db is followed by this output jupyterhub | [E 2023-06-29 09:32:13.769 JupyterHub app:3297] jupyterhub | Traceback (most recent call last): jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 3294, in launch_instance_async jupyterhub | await self.initialize(argv) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 2813, in initialize jupyterhub | self.init_db() jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/app.py", line 1777, in init_db jupyterhub | dbutil.upgrade_if_needed(self.db_url, log=self.log) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/dbutil.py", line 112, in upgrade_if_needed jupyterhub | orm.check_db_revision(engine) jupyterhub | File "/usr/local/lib/python3.8/dist-packages/jupyterhub/orm.py", line 949, in check_db_revision jupyterhub | alembic_revision = engine.execute( jupyterhub | AttributeError: 'Engine' object has no attribute 'execute' jupyterhub | jupyterhub | [D 2023-06-29 09:32:13.770 JupyterHub application:1028] Exiting application: jupyterhub notebook-dev |

Informations given about jupyterhub and sqlalchemy can be found here: jupyterhub/dockerspawner#477 https://github.com/jupyterhub/dockerspawner/issues/477 or here: jupyterhub/dockerspawner#478 https://github.com/jupyterhub/dockerspawner/issues/478

As far as I see Jupyterhub 2.3.1 pinned sqlalchemy <2. My try to force sqlalchemy to version 2 lead to successful installation of nbgrader 0.8.4 but destroyed the hub.

I will try working with version 0.8.3 of nbgrader.

— Reply to this email directly, view it on GitHub https://github.com/jupyter/nbgrader/issues/1796#issuecomment-1614177370, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQPXHIL54JCSRPPUXNCMHLXNZU6LANCNFSM6AAAAAAZYLAMB4 . You are receiving this because you commented.Message ID: @.***>

brichet commented 1 year ago

Fixed with:

Released in: