You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting "Executed file not found" error when .py file present along with .ipynb #9689
bugSomething isn't workingearly-in-releaseAn issue that should be worked on early in the release (likely due to risk)engines-jupyterAnything related to Jupyter engine
I am trying to compile a book with quarto, sourced by .ipynb files. I have chapters specified in the _quarto.yml and they are all .ipynb files. When doing quarto render I get the error if any of the .ipynb files also have a .py file with the same name, and no error if I remove the .py file. Is this expected? I usually have as a default for my Jupyter to always save a .py with my .ipynb to make it easier for searching through old work. Thanks!
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Your environment
Python 3 installation....Version: 3.11.8 (Conda)
Mac 14.4.1
Quarto check output
Quarto 1.4.554
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.4.554
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /Library/TeX/texbin
Version: 2023
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.11.8 (Conda)
Path: /opt/anaconda3/envs/work/bin/python
Jupyter: 5.5.0
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? The goal is to make it as easy as possible for us to recreate your problem so that we can fix it: please help us help you! Thanks.
If you have multiple files (and if it is absolutely required to have multiple files), please share as a Git repository.
R
Python
````qmd---
title: "Reproducible Quarto Document"
format: html
engine: knitr
---
This is a reproducible Quarto document.
```{r}x <- c(1, 2, 3, 4, 5)y <- c(1, 4, 9, 16, 25)plot(x, y)```
The end.
````
````qmd---
title: "Reproducible Quarto Document"
format: html
engine: jupyter
---
This is a reproducible Quarto document.
```{python}import matplotlib.pyplot as pltx = [1, 2, 3, 4, 5]y = [1, 4, 9, 16, 25]plt.plot(x, y)plt.show()```
The end.
````
and a TestChapter.py which is a python export of that notebook. If the .py is there, the error happens when rendering pdf, but the html render also fails -- only silently.
remove the .py file, everything works.
Does that help?
Reacted by Mickaël Canouil and Christophe Dervieux
If a .qmd or .py with same file stem exists, then add the ipynb input as intermediates
This does not check that the .py script is a percent script - it will consider all py script with same name.
Maybe just adding this specific check would be working. I don't think we can allow a .py percent script and a ipynb of the same name.
Otherwise, more generally, it seems odd that an input file can be then filtered out as intermediates but I guess any produced ipynb could be seen as input but they could be intermediates leftover from previous run.
Anyhow, these lines are the source of the issue;
Summary of the current process:
Quarto see the index.qmd and TestChapter.ipynb as input files for the book project
bugSomething isn't workingearly-in-releaseAn issue that should be worked on early in the release (likely due to risk)engines-jupyterAnything related to Jupyter engine
Activity
cscheid commentedon May 15, 2024
We have support for percent scripts: https://quarto.org/docs/computations/render-scripts.html#syntax . I suspect what's happening is that our code for determining which inputs are .qmd files and which inputs are .py files is going wrong.
mcanouil commentedon May 15, 2024
Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? The goal is to make it as easy as possible for us to recreate your problem so that we can fix it: please help us help you! Thanks.
You can share a self-contained "working" (reproducible) Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four
````).See https://quarto.org/bug-reports.html#small-is-beautiful-aim-for-a-single-document-with-10-lines.
If you have multiple files (and if it is absolutely required to have multiple files), please share as a Git repository.
Additionally and if not already given, please share the output of
quarto checkwithin a code blocks (i.e., using three backticks```txt), see https://quarto.org/bug-reports.html#check.bblais commentedon May 15, 2024
Here is a reproducible example in 4 very small files.
quarto_error.zip
There's _quarto.yml
an index.qmd
and a TestChapter.ipynb with a single cell
and a TestChapter.py which is a python export of that notebook. If the .py is there, the error happens when rendering pdf, but the html render also fails -- only silently.
remove the .py file, everything works.
Does that help?
cscheid commentedon May 15, 2024
It does, thank you.
cderv commentedon May 23, 2024
That is really helpful to help reproduce and investigate.
What happens is that,
TestChapter.ipynbis identified somehow as an intermediate and so filter out from project filesquarto-cli/src/project/project-context.ts
Lines 796 to 801 in 76d4ae6
And this is indeed seen as intermediates because of the
.pyfile existence with same namequarto-cli/src/execute/jupyter/jupyter.ts
Lines 594 to 608 in 76d4ae6
It seems our logic for Jupyter engine is
.ipynbto intermediatesThis does not check that the .py script is a percent script - it will consider all py script with same name.
Maybe just adding this specific check would be working. I don't think we can allow a .py percent script and a ipynb of the same name.
Otherwise, more generally, it seems odd that an input file can be then filtered out as intermediates but I guess any produced ipynb could be seen as input but they could be intermediates leftover from previous run.
Anyhow, these lines are the source of the issue;
Summary of the current process:
index.qmdandTestChapter.ipynbas input files for the book projectquarto-cli/src/project/types/book/book-config.ts
Lines 243 to 249 in 76d4ae6
projectInputFilesquarto-cli/src/project/project-context.ts
Lines 776 to 794 in 76d4ae6
quarto-cli/src/project/project-context.ts
Lines 732 to 799 in 76d4ae6
And the end, it is clear that the intermediates are filtered out from Project input files
.ipynbas an intermediatequarto-cli/src/execute/jupyter/jupyter.ts
Lines 594 to 608 in 76d4ae6
Possible fix for it:
It depends if we want to fix it that way
cderv commentedon May 23, 2024
@cscheid I think your recent fix at
probably makes all this file handling obsolete, or maybe possibly not working as they should...
I understand that now, our intermediates will be
.quarto_ipynbhttps://github.com/quarto-dev/quarto-cli/blob/4a28c314bfe05210fc4d07ada5b19aad57f57eff/src/execute/jupyter/jupyter.ts#L195-L201
All this file computations for intermediates but also the
keep-ipynbare impacted and should consider.quarto_ipynbit seems.1 remaining item