Christian Million
Christian Million

Reputation: 692

Quarto Unable to Render Python

I cannot render Quarto documents that contain Python code chunks.

I can successfully render Quarto documents that contain R code chunks.

Error message

The error message I receive is:

==> quarto preview example.Qmd --to html --no-watch-inputs --no-browse

ERROR: Unable to render example.Qmd

Stack trace:
    at fileExecutionEngineAndTarget (file:///C:/PROGRA~1/Quarto/bin/quarto.js:41260:15)
    at async renderContexts (file:///C:/PROGRA~1/Quarto/bin/quarto.js:72183:32)
    at async renderFormats (file:///C:/PROGRA~1/Quarto/bin/quarto.js:72234:22)
    at async file:///C:/PROGRA~1/Quarto/bin/quarto.js:98062:24
    at async Command.fn (file:///C:/PROGRA~1/Quarto/bin/quarto.js:98059:25)
    at async Command.execute (file:///C:/PROGRA~1/Quarto/bin/quarto.js:8104:13)
    at async quarto (file:///C:/PROGRA~1/Quarto/bin/quarto.js:114968:5)
    at async file:///C:/PROGRA~1/Quarto/bin/quarto.js:114986:9

Reprex

It's not quite a reproducible example, but it's the best I can achieve given the error.

I am using the following CLI syntax to render an example document which lives on my Desktop:

quarto render Desktop\example.Qmd

The contents of Desktop\example.Qmd are (when I attempt python - I just switch the 'python' to 'r' when I want to render R.):

---
title: Example
subtitle: Example
format: html
---

```{python}
2 + 2
```

SetUp

Machine

Microsoft Windows 11 Home

Version 10.0.22621 Build 22621

Software Versions

All of the paths listed below are on my PATH Environment variable.

Jupyter

Following Using Python from Quarto, i used the following command to install Jupyter:

py -m pip install jupyter

Which was installed at C:\Users\me\appdata\roaming\python\python312\site-packages

Running the Quarto command quarto check jupyter returns:

Quarto 1.4.547
[>] Checking Python 3 installation....OK
      Version: 3.12.1
      Path: C:/Program Files/Python312/python.exe
      Jupyter: 5.7.1
      Kernels: python3

[>] Checking Jupyter engine render....OK

Upvotes: 1

Views: 512

Answers (1)

Christian Million
Christian Million

Reputation: 692

I have determined that the issue is using the .Qmd extension as opposed to the .qmd extension.

Using the .Qmd extension works when rendering R codechunks, but causes an error when rendering Python chunks.

When I change the extension to .qmd, the python version runs successfully.

I would expect the behavior across both languages to be the same (either generate an error for both languages or successfully render both documents), so I have filed an issue on Github.

Upvotes: 1

Related Questions