-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
student python packages can interfere with nbgrader #1842
Labels
Comments
What is the actual error you observed? |
I'm giving you the whole error below. But note the last line, which is the key. It's using sqlalchemy from the user's home directory. When I remove /home/XXX/.local/lib, it starts working.
I can force a failure by defining any module used by jupyterhub with a bogus definition in /home/XXX/.local
I can fix it by setting
env['PYTHONNOUSERSITE'] = "1"
in LocalProcessSpawner getenv
However that's less than optimal, because that environment variable is then set in all kernels, which we don't want. We want users to be able to use their own modules in code they write. For the moment I'm adding env['PYTHONNOUSERSITE'] = "" to all the kernel.json files.
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: [W 2023-10-22 01:29:58.809 SingleUserLabApp manager:327] nbgrader.server_extensions.assignment_list | err\
or adding extension (enabled: True): The module 'nbgrader.server_extensions.assignment_list' could not be found (cannot import name 'DeclarativeBase' from\
'sqlalchemy.orm' (/home/as3900/.local/lib/python3.11/site-packages/sqlalchemy/orm/__init__.py)). Are you sure the extension is installed?
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: Traceback (most recent call last):
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 17\
5, in _validate_name
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: self._module, self._metadata = get_metadata(name)
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: ^^^^^^^^^^^^^^^^^^
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/utils.py", line 60, \
in get_metadata
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: module = importlib.import_module(package_name)
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/importlib/__init__.py", line 126, in import_module
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: return _bootstrap._gcd_import(name[level:], package, level)
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap_external>", line 940, in exec_module
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/__init__.py", line 11, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from .server_extensions.assignment_list import load_jupyter_server_extension as load_assignments
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/server_extensions/assignment_list/__\
init__.py", line 1, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from .handlers import load_jupyter_server_extension
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/server_extensions/assignment_list/ha\
-
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from .handlers import load_jupyter_server_extension
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/server_extensions/assignment_list/ha\
ndlers.py", line 17, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from ...exchange import ExchangeFactory, ExchangeError
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/exchange/__init__.py", line 5, in <m\
odule>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from .exchange_factory import ExchangeFactory
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/exchange/exchange_factory.py", line \
4, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from nbgrader.exchange import default, abc
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/exchange/default/__init__.py", line \
7, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from .collect import ExchangeCollect
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/exchange/default/collect.py", line 1\
3, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from ...api import Gradebook, MissingEntry
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: File "/usr/lib/anaconda3/lib/python3.11/site-packages/nbgrader/api.py", line 11, in <module>
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: from sqlalchemy.orm import (sessionmaker, scoped_session, relationship,
Oct 22 01:29:58 data7.cs.rutgers.edu jupyterhub: ImportError: cannot import name 'DeclarativeBase' from 'sqlalchemy.orm' (/home/XXXx/.local/lib/pyth\
on3.11/site-packages/sqlalchemy/orm/__init__.py)
O
…________________________________
From: Jakub Klinkovský ***@***.***>
Sent: Wednesday, October 25, 2023 3:39 PM
To: jupyter/nbgrader ***@***.***>
Cc: Charles Hedrick ***@***.***>; Author ***@***.***>
Subject: Re: [jupyter/nbgrader] student python packages can interfere with nbgrader (Issue #1842)
What is the actual error you observed?
—
Reply to this email directly, view it on GitHub<#1842 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAORUCATXIVRX4QMWI7ACNLYBFTGBAVCNFSM6AAAAAA6PYCQMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZZHEZTKMRUGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Operating system
Ubuntu 22.03
nbgrader --version
Python version 3.11.3 (main, Apr 19 2023, 23:54:32) [GCC 11.2.0]
nbgrader version 0.8.4
jupyterhub --version
(if used with JupyterHub)3.1.1
jupyter
lab--version
3.6.5
Expected behavior
Several students installed versions of sqlalchemy for use in their notebooks. This causes nbgrader to be unable to find their assignments. My interpretation of the error is that nbgrader tried to use their version of sqlalchemy, and it was missing an extension needed by nbgrader.
I would expect that the jupyter framework and nbgrader would use python paths that don't include anything in the user's home directory. I tried to modify code to do this, but was unable to find a place that fixed the problem.
The text was updated successfully, but these errors were encountered: