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

"Module not found" error when autograding #1876

Open jnak12 opened 7 months ago

jnak12 commented 7 months ago

Operating system

RedHat

nbgrader --version

0.9.1

jupyterhub --version (if used with JupyterHub)

4.1

jupyter notebook --version

7.1.2

Expected behavior

We have an assignment that was put in a folder and it has the following files: CGastTest.ipynb
CGwat.ipynb CGwatTest.ipynb P0.ipynb P0ParsingTest.ipynb P0TypeCheckingTest.ipynb SC.ipynb SCTest.ipynb ST.ipynb STTest.ipynb '01 Extending P0 with Bitwise Set Operations (WASM) [24 points].ipynb'

Inside some of the files (e.g. P0ParsingTest.ipynb) are the lines:

import nbimporter; nbimporter.options["only_defs"] = False from P0 import compileString

Expected behaviour: file is auto graded.

Actual behavior

If the file is opened, each cell runs without issue. But once submitted and autograded, the following error shows up:

ModuleNotFoundError: No module named 'P0'

From what I have been told, nbimporter converts a notebook to a module.

perllaghu commented 7 months ago

I know nothing about nbimporter, so can't help with that, however I'm also surprised to get to autograde '01 Extending P0 with Bitwise Set Operations (WASM) [24 points].ipynb' (I would have expected the braces to give you problems)

jnak12 commented 7 months ago

That seems to be okay. I don't know much about nbimporter either, but if it has to create a new file from the notebook conversion, where would it put that file? In the autograded directory? Can files get created in the autograded directory?

brichet commented 7 months ago

Thanks for opening this @jnak12.

Except if there is another repo for nbimporter, I would recommend not to use this package: https://github.com/grst/nbimporter?tab=readme-ov-file#update-2019-06-i-do-not-recommend-any-more-to-use-nbimporter