quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.75k stars 306 forks source link

PermissionDenied: Access is denied when using typst custom partial #10522

Open cderv opened 4 weeks ago

cderv commented 4 weeks ago

Hi, I have a similar issue as #6616 when attempting to render to typst. It happens only when my input file includes template partials in the frontmatter.

I am using Windows and calling Quarto from the Anaconda Powershell console.

Actual behavior

(base) PS C:\temp\friday> quarto render .\minimal.qmd --to typst

ERROR: PermissionDenied: Access is denied. (os error 5): remove 'C:\Users\abcd~1\AppData\Local\Temp\quarto-session5f604da5085388b6\56d80c0e57b03f0\3b45073bb66480b1\typst-show2.typ'

Stack trace:
    at Object.removeSync (ext:deno_fs/30_fs.js:250:3)
    at copyFileSync1 (file:///C:/Program%20Files/Quarto/bin/quarto.js:42001:14)
    at copyTo (file:///C:/Program%20Files/Quarto/bin/quarto.js:41948:9)
    at stageContext (file:///C:/Program%20Files/Quarto/bin/quarto.js:42139:21)
    at stageTemplate (file:///C:/Program%20Files/Quarto/bin/quarto.js:42148:30)
    at runPandoc (file:///C:/Program%20Files/Quarto/bin/quarto.js:69556:42)
    at async renderPandoc (file:///C:/Program%20Files/Quarto/bin/quarto.js:70717:26)
    at async Object.onRender (file:///C:/Program%20Files/Quarto/bin/quarto.js:78268:36)
    at async renderFileInternal (file:///C:/Program%20Files/Quarto/bin/quarto.js:78245:17)
    at async renderFiles (file:///C:/Program%20Files/Quarto/bin/quarto.js:78069:17)

The error points to a path the does not exist, starting from the quarto-session folder: 'C:\Users\abcd~1\AppData\Local\Temp\quarto-session5f604da5085388b6\56d80c0e57b03f0\3b45073bb66480b1\typst-show2.typ'

Observations:

Stuff I tried and did not work

The minimal quarto file is:

---
title: "Hello"
format:
  typst:
    keep-typ: true
    template-partials:
      - typst-template.typ
      - typst-show2.typ
---

# Is it me you are looking for
I can see it in your eyes

Quarto check output

(base) PS C:\temp\friday> quarto check

Quarto 1.5.55

[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK

[>] Checking versions of quarto dependencies......OK

[>] Checking Quarto installation......OK
      Version: 1.5.55
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: v2024.07.03
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\abcdval\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2024

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.10.9 (Conda)
      Path: C:/Users/abcdval/AppData/Local/anaconda3/python.exe
      Jupyter: 5.2.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/

My environment

Edition: Windows 10 Pro Version: 22H2 OS build 19045.4651 Experience: Windows Feature Experience Pack 1000.19060.1000.0

I have the minimal example as well as the template partials in my repo: https://github.com/poc-chuc/quarto_and_typst

Originally posted by @poc-chuc in https://github.com/quarto-dev/quarto-cli/issues/6616#issuecomment-2290795012

GuyHedelin commented 3 weeks ago

Hi, I have the same type of problem when trying to generate a pdf. Sometimes for the same qmd file the access to the temporary tex file in the quarto-session directory is denied with the error code 32 (an other process is using the file). I can see that the temporary tex file is troncated when the error occurs. I use the last stable rstudio version 2024.04.2 Build 764. Windows 10 pro. Thanks if you can correct this behavior

GuyHedelin commented 3 weeks ago

==> quarto preview exemples_brochure.qmd --to pdf --no-watch-inputs --no-browse

processing file: exemples_brochure.qmd |................................ | 62% [unnamed-chunk-4]pdfcrop: security risk: running with elevated privileges pdftex: security risk: running with elevated privileges |................................................ | 92% [unnamed-chunk-6]pdfcrop: security risk: running with elevated privileges pdftex: security risk: running with elevated privileges

output file: exemples_brochure.knit.md

pandoc to: latex output-file: exemples_brochure.tex standalone: true pdf-engine: xelatex variables: graphics: true tables: true default-image-extension: pdf

metadata documentclass: scrartcl classoption:

ERROR: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. (os error 32): writefile 'C:\Users\GUY~1.HED\AppData\Local\Temp\quarto-session35821157\112aecb1\6ca0dc3a.tex'

Stack trace: at writeFileSync (ext:deno_fs/30_fs.js:769:7) at Object.writeTextFileSync (ext:deno_fs/30_fs.js:832:10) at processLines (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:71002:22) at eventLoopTick (ext:core/01_core.js:183:11) at async file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:70969:9 at async Object.complete (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:70082:37) at async Object.onPostProcess (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:77272:36) at async renderFileInternal (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:77256:5) at async renderFiles (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:77068:17) at async render (file:///C:/PROGRA~1/RStudio/RESOUR~1/app/bin/quarto/bin/quarto.js:81813:21)

mcanouil commented 3 weeks ago

@GuyHedelin Your issue is unrelated. You are using LaTeX not Typst. Also copy/pasting a log without code/context is not helpful. Please open a new issue and follow the guidelines provided when doing so. Thank you! Don't open a new issue if you are working inside a directory synchronised on a Cloud service such as OneDrive, DropBox, etc. This is a known and already reported issue.