'HTMLExporter' object has no attribute 'template_path'

I have just created a new (empty) nbdev project.

After successfully running,

nbdev_clean_nbs
nbdev_build_lib
nbdev_test_nbs

I get the above error with

nbdev_build_docs

Any idea what the problem is?

Here is the full error:

(pctdev36) C:\Users\ryoung\Versioning\python\nbdev\epct>nbdev_build_docs
converting: C:\Users\ryoung\Versioning\python\nbdev\epct\nbs\index.ipynb
converting: C:\Users\ryoung\Versioning\python\nbdev\epct\nbs\00_core.ipynb
‘HTMLExporter’ object has no attribute ‘template_path’
‘HTMLExporter’ object has no attribute ‘template_path’
Traceback (most recent call last):
File “c:\users\ryoung.conda\envs\pctdev36\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “c:\users\ryoung.conda\envs\pctdev36\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\ryoung.conda\envs\pctdev36\Scripts\nbdev_build_docs.exe_main
.py", line 7, in
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\fastscript\core.py”, line 76, in _f
func(**args.dict)
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\nbdev\cli.py”, line 219, in nbdev_build_docs
notebook2html(fname=fname, force_all=force_all, n_workers=n_workers)
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\nbdev\export2html.py”, line 579, in notebook2html
raise Exception(msg + ‘\n’.join([f.name for p,f in zip(passed,files) if not p]))
Exception: Conversion failed on the following:
00_core.ipynb
index.ipynb

This suggests there could be a syntax error in the code in one of your notebooks

I have pared things down to a single notebook, index.ipynb, which is virtually empty and get the same problem. I have reverted to python 3.6.

Can you spot anything wrong with this file?

{
“cells”: [
{
“cell_type”: “markdown”,
“metadata”: {},
“source”: [
“# XX”
]
},
{
“cell_type”: “markdown”,
“metadata”: {},
“source”: [
“xx”
]
}
],
“metadata”: {
“kernelspec”: {
“display_name”: “Python 3”,
“language”: “python”,
“name”: “python3”
},
“language_info”: {
“codemirror_mode”: {
“name”: “ipython”,
“version”: 3
},
“file_extension”: “.py”,
“mimetype”: “text/x-python”,
“name”: “python”,
“nbconvert_exporter”: “python”,
“pygments_lexer”: “ipython3”,
“version”: “3.6.12”
},
“toc”: {
“base_numbering”: 1,
“nav_menu”: {},
“number_sections”: true,
“sideBar”: true,
“skip_h1_title”: false,
“title_cell”: “Table of Contents”,
“title_sidebar”: “Contents”,
“toc_cell”: false,
“toc_position”: {},
“toc_section_display”: true,
“toc_window_display”: false
}
},
“nbformat”: 4,
“nbformat_minor”: 2
}

‘HTMLExporter’ object has no attribute ‘template_path’
Traceback (most recent call last):
File “c:\users\ryoung.conda\envs\pctdev36\lib\runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “c:\users\ryoung.conda\envs\pctdev36\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\ryoung.conda\envs\pctdev36\Scripts\nbdev_build_docs.exe_main
.py", line 7, in
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\fastscript\core.py”, line 76, in _f
func(**args.dict)
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\nbdev\cli.py”, line 219, in nbdev_build_docs
notebook2html(fname=fname, force_all=force_all, n_workers=n_workers)
File “c:\users\ryoung.conda\envs\pctdev36\lib\site-packages\nbdev\export2html.py”, line 579, in notebook2html
raise Exception(msg + ‘\n’.join([f.name for p,f in zip(passed,files) if not p]))
Exception: Conversion failed on the following:
index.ipynb

Btw, I have been installing nbdev like this,

pip install nbdev==0.2.20

It seems to be an error with versions.

It fails on python 3.6 but works on 3.7.

Correction. It works with python 3.7.9 on Windows, but fails with python 3.7.9 on Linux (WSL).

Maybe I am missing a python package. Which are needed for this?

I think I managed to resolve this by downgrading nbconvert from 6.0.7

pip install nbconvert==5.6.1

Is nbconvert an nbdev package?

5 Likes

No it’s a Jupyter package.

Had the same error and this fixed it, thanks!

I had the same issue. Downgrading from python 3.9 to python 3.8.6 solved it

1 Like

worked for me, thank you!:
conda install nbconvert=5.6.1

4 Likes

I had the same problem. For me, it seems to have been caused by conflicting pip vs. conda installations of packages.

nbdev and nbconvert seemed to have the correct versions in conda list, but I still got the error. The following line fixed the problem by (re-)installing nbconvert from pip:

pip3 install nbdev
1 Like

Hi, this work for me as well. Many thanks.

conda install nbconvert=5.6.1

Thanks. That worked for me as well.

This might be helpful to make sure environment matches requirements, the nbdev settings.ini file contains a requirements section

On my local environment, installing nbdev using pip3 installed nbconvert=5.6.1 but conda install -c fastai nbdev installed nbconvert=6.0.7 (which does not match the requirements listed in the settings.ini file)

Since nbconvert 6.0, template_path has become template_paths (cf https://nbconvert.readthedocs.io/en/latest/changelog.html)

3 Likes

I had a similar problem and somehow pip install nbdev worked. I don’t know why but it ran fine after reinstalling.

There was a library mismatch between nbdev and nbconvert. Seems nbconvert < 6 is compatible with nbdev. If u face issue uninstall both and reinstall nbdev. This worked for me.

1 Like

pip3 install nbdev --upgrade

solve the issue.

1 Like