Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Error: Couldn't find an svg element in svg string #12038

Closed
juliohm opened this issue Feb 6, 2025 · 17 comments
Closed

Internal Error: Couldn't find an svg element in svg string #12038

juliohm opened this issue Feb 6, 2025 · 17 comments
Labels
duplicate This issue or pull request already exists

Comments

@juliohm
Copy link

juliohm commented Feb 6, 2025

Bug description

ERROR: Internal Error: Couldn't find an svg element in svg string

This is a bug in quarto. We apologize for the inconvenience.
Please consider reporting it at https://github.com/quarto-dev/quarto-cli. Thank you!

Stack trace:
    at resolveSize (file:///opt/quarto/bin/quarto.js:82001:15)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async makePng (file:///opt/quarto/bin/quarto.js:82344:55)
    at async makeDefault (file:///opt/quarto/bin/quarto.js:82396:24)
    at async Object.cell (file:///opt/quarto/bin/quarto.js:82419:20)
    at async Promise.all (index 0)
    at async Object.document (file:///opt/quarto/bin/quarto.js:39218:25)
    at async handleLanguageCells (file:///opt/quarto/bin/quarto.js:39188:42)
    at async file:///opt/quarto/bin/quarto.js:85737:51
    at async withTimingAsync (file:///opt/quarto/bin/quarto.js:16889:25)

Steps to reproduce

Run quarto render --to pdf on this project: https://github.com/JuliaEarth/geospatial-data-science-with-julia

Expected behavior

PDF output.

Actual behavior

Error message.

Your environment

Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_THREADS = 8

Quarto check output

Quarto 1.7.6
[✓] Checking environment information...
      Quarto cache location: /home/juliohm/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.7.6
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      Chromium: 869685
      TinyTeX: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.1
      Path: /usr/bin/python3
      Jupyter: 5.7.2
      Kernels: python3, julia-1.11, julia-1.10, julia-1.9

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

[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /usr/lib64/R
      LibPaths:
        - /usr/lib/R/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")
@mcanouil
Copy link
Collaborator

mcanouil commented Feb 6, 2025

As explained in your previous report, it's not possible to debug a project that big.

Please take out everything until you end up with something small that can be used to reproduce the issue.

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Feb 6, 2025
@juliohm
Copy link
Author

juliohm commented Feb 6, 2025

The issue occurs in the preface.qmd. You can comment out all other chapters in the _quarto.yml file to reproduce the issue. The root seems to be related to the inline svg files, e.g.:

https://github.com/JuliaEarth/geospatial-data-science-with-julia/blob/b00c144aafe8ce26e99cf037fb2ba7fb91233bb7/preface.qmd#L16

@mvf
Copy link

mvf commented Feb 7, 2025

I'm also affected by this Quarto 1.6.12 regression. Going back to 1.6.11 for now.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Could any of you share something small to allow us to reproduce?
Like creating a book with:

quarto create project book issue12038

and modify this project with whatever is needed to reproduce.

Using the current development version and assuming the issue was "inline svg", I cannot reproduce:

https://github.com/mcanouil/quarto-issues-experiments/tree/main/quarto-cli-12038

@mvf
Copy link

mvf commented Feb 7, 2025

Good news, this seems to be user/configuration error. Just a better error message would be nice 😅.

It occurs trying to render {mermaid} blocks without chromium-browser in PATH. Confirmed working on both 1.6.12 and 1.7.13 after fixing my environment.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

@juliohm

The issue occurs in the preface.qmd. You can comment out all other chapters in the _quarto.yml file to reproduce the issue. The root seems to be related to the inline svg files, e.g.:

https://github.com/JuliaEarth/geospatial-data-science-with-julia/blob/b00c144aafe8ce26e99cf037fb2ba7fb91233bb7/preface.qmd#L16

That's not how it works unfortunately.

I cannot reproduce you claim if I remove all chapters and also all content below the line you referenced.

project:
  type: book

book:
  title: "Geospatial Data Science with Julia"
  cover-image: "images/cover.svg"
  author: "Júlio Hoffimann"
  date: today
  chapters:
    - index.qmd
    - preface.qmd

bibliography: references.bib

format:
  html:
    theme:
      light: flatly
      dark: solar
    mermaid:
      theme: dark
Image

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Good news, this seems to be user/configuration error. Just a better error message would be nice 😅.

It occurs trying to render {mermaid} blocks without chromium-browser in PATH. Confirmed working on both 1.6.12 and 1.7.13 after fixing my environment.

@mvf Thanks this is helpful!

@juliohm do you have any chromium-based browser in your environments?
Chrome changed some options used to basically "take a screenshot" of HTML components such as diagrams made with mermaid. The current "chromium" version that Quarto offers to install is outdated, but browser you have installed are not.

Since you are using the pre-release, could you try with the latest pre-release?

For reference:

Worth reading:

@juliohm
Copy link
Author

juliohm commented Feb 7, 2025

@juliohm do you have any chromium-based browser in your environments?

I have Chromium installed, but Quarto asked me to install a local one with quarto install chromium. Should I uninstall the local one and update my PATH to point to the global Chromium installation?

@juliohm
Copy link
Author

juliohm commented Feb 7, 2025

Actually, my system-wide chromium is already available in my PATH under /usr/bin. Perhaps this issue is caused by the executable name assumed by Quarto? The name chromium-browser is not appropriate in this case.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Quarto should use your "main" chromium-based version if it finds it.
If Quarto asked you to install chromium, it's because it did not find your browser for some reason specific to your environment.

You can see in the issue I have linked that for Quarto >1.6 the chromium that Quarto install won't work.

You can uninstall the version installed by Quarto. it won't hurt.

I suggest to read the other issue/thread I've linked which contains several things that I don't have the time right now to copy/paste:

@juliohm
Copy link
Author

juliohm commented Feb 7, 2025

The quarto render --to pdf proceeds if I add

export QUARTO_CHROMIUM=/usr/bin/chromium
export QUARTO_CHROMIUM_HEADLESS_MODE=new

to my .bashrc

So there is no action to take on Quarto itself to improve the situation?

@juliohm
Copy link
Author

juliohm commented Feb 7, 2025

Now I get another error related to a .gif file:

ERROR: 
compilation failed- error
LaTeX Error: Cannot determine size of graphic in images/juliahearts.gif (no BoundingBox).

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.550 ...keepaspectratio]{images/juliahearts.gif}}

Should GIF be supported in PDF output?

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

I've linked the issues that track the "chromium" issues.

This issue appears to be a duplicate of them.

Regarding Gif, that's a completely different issue independent of Quarto.
Quarto does not control the abilities of the underlying language which in your case is LaTeX.
You can look at the log as suggested by the message and use keep-tex: true to investigate the LaTeX code.
I believe the solution can be found on the internet as it's likely faced by other LaTeX users in the last 20+ years.

@mcanouil mcanouil added duplicate This issue or pull request already exists and removed bug Something isn't working needs-repro Issues that are blocked until reporter provides an adequate reproduction labels Feb 7, 2025
@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Duplicate of #11877

@mcanouil mcanouil marked this as a duplicate of #11877 Feb 7, 2025
@juliohm
Copy link
Author

juliohm commented Feb 7, 2025 via email

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Please feel free to close the issue if it there is nothing to do regarding
the chromium situation.

There is something to be done to be clear but it's being tracked in other issues already.

@mcanouil
Copy link
Collaborator

mcanouil commented Feb 7, 2025

Regarding your other issue, if really you don't find the LaTeX solution to include Gif, you can open a GitHub Discussion with a small reproducible example (not the whole project).
Something like:

---
format: pdf
---

![whatever](path/to/image.giff)

@mcanouil mcanouil closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants