Comments (5)
Hi @komal98, it isn't recommended to use the brew python as your user python: https://justinmayer.com/posts/homebrew-python-is-not-for-you/.
I'd suggest either using a Python from python.org, or if you want to try sticking with brew:
pip3 uninstall -y nbconvert
pip3 install -v nbconvert
And paste the output here.
from nbconvert.
Hi @komal98! Can you share the commands you used?
I tried the following:
$ which python
/Library/Frameworks/Python.Framework/Versions/3.11/bin/python3
$ python --version
Python 3.11.5
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install nbconvert
$ ls .venv/share/jupyter/nbconvert/templates
. asciidoc basic compatibility latex python rst webpdf
.. base classic lab markdown reveal script
from nbconvert.
$ jupyter --paths
config:
/Users/<username>/.jupyter
/Users/<username>/Library/Python/3.11/etc/jupyter
/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/Users/<username>/Library/Jupyter
/Users/<username>/Library/Python/3.11/share/jupyter
/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/Users/<username>/Library/Jupyter/runtime
$ ls /Users/<username>/Library/Python/3.11/share/jupyter/nbconvert/templates
latex
I had used brew to install python and jupyter and pip3 install nbconvert.
When I try to convert my ipynb file to pdf, I get the jinja exception:
$ jupyter nbconvert --to pdf notebook.ipynb
[NbConvertApp] Converting notebook notebook.ipynb to pdf Traceback (most recent call last): File "/opt/homebrew/bin/jupyter-nbconvert", line 8, in <module> sys.exit(main()) ^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/jupyter_core/application.py", line 283, in launch_instance super().launch_instance(argv=argv, **kwargs) File "/opt/homebrew/lib/python3.11/site-packages/traitlets/config/application.py", line 1075, in launch_instance app.start() File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 420, in start self.convert_notebooks() File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks self.convert_single_notebook(notebook_filename) File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 563, in convert_single_notebook output, resources = self.export_single_notebook( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook output, resources = self.exporter.from_filename( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 386, in from_filename return super().from_filename(filename, resources, **kw) # type:ignore[return-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 201, in from_filename return self.from_file(f, resources=resources, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 392, in from_file return super().from_file(file_stream, resources, **kw) # type:ignore[return-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 220, in from_file return self.from_notebook_node( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/pdf.py", line 184, in from_notebook_node latex, resources = super().from_notebook_node(nb, resources=resources, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/latex.py", line 92, in from_notebook_node return super().from_notebook_node(nb, resources, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 424, in from_notebook_node output = self.template.render(nb=nb_copy, resources=resources) ^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 164, in template self._template_cached = self._load_template() ^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 380, in _load_template return self.environment.get_template(template_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/jinja2/environment.py", line 997, in get_template return self._load_template(name, globals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/jinja2/environment.py", line 958, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/jinja2/loaders.py", line 566, in load raise TemplateNotFound(name) jinja2.exceptions.TemplateNotFound: index.tex.j2
from nbconvert.
@blink1073 I uninstalled the brew version of Python and used Python from python.org and it worked!!! Thank you so much.
from nbconvert.
Great! No problem
from nbconvert.
Related Issues (20)
- Reveal.js slideshow export should skip `{ "slide_type": "-" }` cells HOT 1
- Setting PDFExporter.enabled = False disables the PDFExporter but does not remove it from the "File -> Download As" menu HOT 2
- Support `pandas.Styler` object HOT 3
- nbconvert fails when notebook contains empty "Raw NBConvert"cell
- error: Execution was interrupted, reason: internal c++ exception breakpoint(-5)
- nbconvert to PDF fails if there are two adjacent spaces in the filename (MacOS)
- Convert to MyST HOT 1
- Word wrapping for print view in HTML output
- Can someone help me out with why my images wont display on my pdf print
- Error in docs example: Using nbconvert as a library: KeyError: 'template_paths' HOT 1
- Section numbering in HTML
- Nbconvert >= 7.14 produces error in Sphinx build HOT 13
- Allow pre-fetching of css files? HOT 2
- matplotlib widgets not interactive when exported to html
- Rendering to HTML generates an error in bleach.clean HOT 5
- No way to disable traceback colors when executing notebook HOT 1
- Jupyter Magic stops `CellExecutionError` handling from working
- Unable to convert .ipynb to .pdf on Mac HOT 1
- Erreur with date metadata
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbconvert.