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

ottr::export fails when pdf can’t be generated #766

Closed
chrispyles opened this issue Jan 21, 2024 — with Slack · 16 comments · Fixed by ucbds-infra/ottr#21
Closed

ottr::export fails when pdf can’t be generated #766

chrispyles opened this issue Jan 21, 2024 — with Slack · 16 comments · Fixed by ucbds-infra/ottr#21
Labels
bug Something isn't working
Milestone

Comments

Copy link
Member

look into both why the pdf can’t be generated and why the zip export fails

Thanks @… here it is https://github.com/dbroockman/PS3-SP24-Public/blob/main/w2/w2a1/student/Week2_Activity1.ipynb

Slack Message

@chrispyles chrispyles added the bug Something isn't working label Jan 21, 2024 — with Slack
@dbroockman
Copy link

Looks like it's not just a PDF issue, I get part of the error on Berkeley R Datahub when setting pdf = FALSE too:
Screenshot 2024-01-21 at 9 06 21 PM

@dbroockman
Copy link

And actually, I even get an error without the force_save = TRUE flag.
Screenshot 2024-01-21 at 9 31 02 PM

@dbroockman
Copy link

Upon further investigation, it's possible at least some of this might be tied to generic Berkeley datahub issues. https://ds-modules.slack.com/archives/C3ESHBX2N/p1705901646319269

@chrispyles
Copy link
Member Author

chrispyles commented Jan 22, 2024

Looks like it's not just a PDF issue, I get part of the error on Berkeley R Datahub when setting pdf = FALSE too: Screenshot 2024-01-21 at 9 06 21 PM

The warning you're seeing is a separate issue -- I'm not sure why force save isn't working. But from the line below the warning, you can see that the zip file was generated, so the bug in this issue is only occurring when pdf = TRUE.

@dbroockman
Copy link

Thanks. With the Datahub issues resolved, looks like the issue persists with force save set to TRUE but the function works without either the force save or PDF flags.

@chrispyles
Copy link
Member Author

Sorry, I'm confused now. Can you send a screenshot of running with both pdf and force_save set to true now that the hub issues are resolved?

@dbroockman
Copy link

Summary:

  • ottr::export("Week2_Activity1.ipynb") works
  • ottr::export("Week2_Activity1.ipynb", force_save = TRUE) error:
Screenshot 2024-01-22 at 9 17 40 AM - `ottr::export("Week2_Activity1.ipynb", pdf = TRUE)` error: Screenshot 2024-01-22 at 9 18 08 AM

@chrispyles
Copy link
Member Author

chrispyles commented Jan 22, 2024

What you're seeing in ottr::export("Week2_Activity1.ipynb", force_save = TRUE) isn't an error but a warning; the zip is still being generated. Not sure why force save isn't working but I'll open a separate issue for that.

For ottr::export("Week2_Activity1.ipynb", pdf = TRUE), can you open a terminal on the hub, cd into the directory with the notebook, and run jupyter nbconvert --to=pdf Week2_Activity1.ipynb and send the output?

@chrispyles
Copy link
Member Author

For ottr::export("Week2_Activity1.ipynb", pdf = TRUE), can you open a terminal on the hub, cd into the directory with the notebook, and run jupyter nbconvert --to=pdf Week2_Activity1.ipynb and send the output?

@dbroockman, any update on this?

@dbroockman
Copy link

Traceback (most recent call last):
  File "/srv/conda/bin/jupyter-nbconvert", line 6, in <module>
    from nbconvert.nbconvertapp import main
  File "/srv/conda/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 193, in <module>
    class NbConvertApp(JupyterApp):
  File "/srv/conda/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 252, in NbConvertApp
    Options include {get_export_names()}.
  File "/srv/conda/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 145, in get_export_names
    e = get_exporter(exporter_name)(config=config)
  File "/srv/conda/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 106, in get_exporter
    exporter = items[0].load()
  File "/srv/conda/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 184, in load
    module = import_module(match.group('module'))
  File "/srv/conda/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/srv/conda/lib/python3.9/site-packages/jupyter_contrib_nbextensions/__init__.py", line 5, in <module>
    import jupyter_nbextensions_configurator
  File "/srv/conda/lib/python3.9/site-packages/jupyter_nbextensions_configurator/__init__.py", line 18, in <module>
    from notebook.base.handlers import APIHandler, IPythonHandler
ModuleNotFoundError: No module named 'notebook.base'

@chrispyles
Copy link
Member Author

Looks like the hub has some incompatible package versions; I'm guessing it's an outdated version of jupyter_nbextensions_configurator. I'd open an issue on the datahub repo that this is preventing nbconvert from being able to export notebooks as PDFs.

From this it looks like notebook v7 (which is what the hub is using) isn't compatible with notebook extensions? I'm not 100% sure.

@dbroockman
Copy link

Thank you, bug opened here: datahub-project/datahub#9732

@chrispyles
Copy link
Member Author

I think that's the wrong repo. Berkeley datahub (afaik) is run from https://github.com/berkeley-dsep-infra/datahub

@dbroockman
Copy link

Thanks for the flag.

@shaneknapp
Copy link

Looks like the hub has some incompatible package versions; I'm guessing it's an outdated version of jupyter_nbextensions_configurator. I'd open an issue on the datahub repo that this is preventing nbconvert from being able to export notebooks as PDFs.

From this it looks like notebook v7 (which is what the hub is using) isn't compatible with notebook extensions? I'm not 100% sure.

yep, this is 100% the case: notebook v7 isn't compatible with notebook v6 extensions.

@chrispyles
Copy link
Member Author

I've opened ucbds-infra/ottr#21 to continue exporting the submission zip if a PDF can't be generated, which should be the only change required on otter's end for this issue. It will be included in v1.5.0 of ottr, which will come out once I've fixed #767 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

3 participants