Skip to content
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

KeyError when calling nbgrader feedback #1158

Closed
bstone opened this issue Jun 19, 2019 · 6 comments
Closed

KeyError when calling nbgrader feedback #1158

bstone opened this issue Jun 19, 2019 · 6 comments
Labels
Milestone

Comments

@bstone
Copy link

bstone commented Jun 19, 2019

I am having an issue when trying to create the feedback of graded assignments. Basically I am getting a KeyError every time I try.

Operating system

MacOS 10.13.6

nbgrader --version

v 0.5.5

jupyterhub --version (if used with JupyterHub)

Not using JupyterHub

jupyter notebook --version

v 5.7.8

Expected behavior

Feedback html files should be created in the feedback/ directory when nbgrader feedback ps1 is called.

Actual behavior

I get the following error and the empty /feedback/stu1/ directory is created. Here is the beginning and end of the error.

bash-3.2$ nbgrader autograde ps1
[AutogradeApp | INFO] Skipping existing assignment: /Users/bstone/test_course/my_test_course_1/autograded/stu1/ps1
bash-3.2$ nbgrader feedback ps1
[FeedbackApp | INFO] Copying /Users/bstone/test_course/my_test_course_1/autograded/stu1/ps1/jupyter.png -> /Users/bstone/test_course/my_test_course_1/feedback/stu1/ps1/jupyter.png
[FeedbackApp | INFO] Converting notebook /Users/bstone/test_course/my_test_course_1/autograded/stu1/ps1/problem1.ipynb
[FeedbackApp | ERROR] There was an error processing assignment: /Users/bstone/test_course/my_test_course_1/autograded/stu1/ps1
[FeedbackApp | ERROR] Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nbgrader/converters/base.py", line 293, in convert_notebooks
        self.convert_single_notebook(notebook_filename)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nbgrader/converters/base.py", line 249, in convert_single_notebook
        output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
   :
   :
   :   MISSING CHUNK HERE 
   :
   : 
        <b>Comments:</b> {{ cell.metadata.nbgrader.comment | markdown2html | strip_files_prefix }}
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nbconvert/exporters/html.py", line 74, in markdown2html
        cell = context['cell']
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/jinja2/runtime.py", line 305, in __getitem__
        raise KeyError(key)
    KeyError: 'cell'

[FeedbackApp | WARNING] Removing failed assignment: /Users/bstone/test_course/my_test_course_1/feedback/stu1/ps1
[FeedbackApp | ERROR] There was an error processing assignment 'ps1' for student 'stu1'
[FeedbackApp | ERROR] Please see the error log (.nbgrader.log) for details on the specific errors on the above failures.
bash-3.2$

Steps to reproduce the behavior

  1. Before starting I ran pip install 'SQLAlchemy==1.2.18' according to the issues discussions.
  2. I used the nbgrader quickstart test_course command to create a course.
  3. I added /tmp/exchange directory and modified the config file as per the documentation.
  4. Then assigned the problems with nbgrader assign ps1.
  5. Next I used the Formgrader to release the assignment.
  6. Then created /submitted/stu1/ps1/ via terminal and copied the released assignments (untouched) into this directory.
  7. Using the jupyter interface, I then autograded and manually graded both problem sets in ps1.
  8. Everything worked fine up to here. But when I run nbgrader feedback ps1 I get the above error.

Not sure what I am doing wrong, but any help will be appreciated. Of course if you want the whole error report, I can post it.

@jhamrick
Copy link
Member

What version of nbconvert are you using? (You can find out with jupyter nbconvert --version). If the version you have is 5.5.0, can you try downgrading to 5.4.1 (you can do this with pip install nbconvert==5.4.1)?

For context: there are some issues with the current version of nbconvert that cause errors with nbgrader, which are fixed on the master version of nbconvert but which have not yet been released yet.

@jhamrick
Copy link
Member

(See also: jupyter/nbconvert#1022)

@jhamrick jhamrick added the bug label Jun 19, 2019
@jhamrick jhamrick added this to the No action milestone Jun 19, 2019
@bstone
Copy link
Author

bstone commented Jun 19, 2019

Thanks! I was running nbconvert 5.5.0 and installing version 5.4.1 solved my problem.

@gtolomei
Copy link

Hello everyone,

I'm facing exactly the same issue described by @b-stone (also running nbconvert 5.5.0).
The weird thing is that this is happening just for a bunch of autograded notebooks, whilst for the others the generation of HTML feedback works smoothly, instead.
Anyway, I'm gonna give a try to the solution proposed by @jhamrick, which apparently fixes the problem.

Many Thanks!
Gabriele

@gtolomei
Copy link

Hi all,

Just to give you a quick update on this. The fix proposed by @jhamrick (i.e., downgrading nbconvert to version 5.4.1) actually solved the issue for me as well.

Thanks,
Gabriele

@jhamrick
Copy link
Member

This should now be fixed in nbconvert 5.6, so I am going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants