notebook-as-pdf
notebook-as-pdf copied to clipboard
nbconvert failed: module 'asyncio' has no attribute 'run'
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
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.