Giter Club home page Giter Club logo

Comments (5)

blink1073 avatar blink1073 commented on August 22, 2024 2

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.

blink1073 avatar blink1073 commented on August 22, 2024 1

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.

komal98 avatar komal98 commented on August 22, 2024

@blink1073

$ 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.

komal98 avatar komal98 commented on August 22, 2024

@blink1073 I uninstalled the brew version of Python and used Python from python.org and it worked!!! Thank you so much.

from nbconvert.

blink1073 avatar blink1073 commented on August 22, 2024

Great! No problem

from nbconvert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.