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

nbconvert failed: module 'asyncio' has no attribute 'run' #36

Open
ENIAC-6 opened this issue Jan 8, 2022 · 1 comment
Open

nbconvert failed: module 'asyncio' has no attribute 'run' #36

ENIAC-6 opened this issue Jan 8, 2022 · 1 comment

Comments

@ENIAC-6
Copy link

ENIAC-6 commented Jan 8, 2022

I am on Python 3.6.9 and trying to download a Jupyter Notebook with markdown cells (containing HTML code) to PDF. I could not find a conda package version of notebook-as-pdf and so I used pip install. However, when tying to download (File > Download as > PDF via HTML (.pdf) I receive the following error: nbconvert failed: module 'asyncio' has no attribute 'run'

Also receive the following error when attempting to download via Python or Anaconda command prompt with: jupyter-nbconvert --to pdfviahtml C:\Users\myProfile\Documents\Jupyter_Notebook\Announcement\Announcement.ipynb

(arcgispro-py3) C:\Users\myProfile>jupyter-nbconvert --to pdfviahtml C:\Users\myProfile\Documents\Jupyter_Notebook\Announcement\Announcement.ipynb
Traceback (most recent call last):
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\Scripts\jupyter-nbconvert-script.py", line 10, in
sys.exit(main())
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\nbconvert\nbconvertapp.py", line 340, in start
self.convert_notebooks()
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\nbconvert\nbconvertapp.py", line 499, in convert_notebooks
cls = get_exporter(self.export_format)
File "C:\Users\myProfile\MyPrograms\ESRI_ArcGIS_Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\nbconvert\exporters\base.py", line 113, in get_exporter
% (name, ', '.join(get_export_names())))
ValueError: Unknown exporter "pdfviahtml", did you mean one of: PDFviaHTML, asciidoc, custom, html, latex, markdown, notebook, pdf, python, rst, script, slides?

@gwhenrie
Copy link

gwhenrie commented Jan 8, 2022

I also encountered this issue when attempting to run via Python 3.6.9

Further research led me to this StackOverflow which clarified that asyncio.run was new in Python 3.7, as seen in the python documentation.

I would therefore suggest that unless supporting the latest version of the pip package on 3.6.9 is critical, the latest package should clarify that it supports 3.7 and onward.

To the person who encountered this issue, I followed the same installation procedure in Python 3.8 and I was able to create a PDF with no issues.

I know its not a fix, but hopefully this gets you running.

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

No branches or pull requests

2 participants