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

Error with chromote R package when trying to render HTML like mermaid or ploty in PDF format #8341

Closed
Patrikios opened this issue Jan 18, 2024 · 11 comments
Labels
bug Something isn't working knitr needs-repro Issues that are blocked until reporter provides an adequate reproduction stale Issues open for 30+ days without providing a "working" reproducible example third-party Issues involving interaction with a third-party library

Comments

@Patrikios
Copy link

Bug description

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

- The project is out-of-sync -- use `renv::status()` for details.


processing file: test.rmarkdown
  |...       |  32% [Ursprung]                                                                    
Quitting from lines 653-704 [Ursprung] (test.rmarkdown)
Error in `startup()`:
! Chrome debugging port not open after 10 seconds.
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
 34. Chrome$new()
 35. chromote (local) initialize(...)
 36. chromote:::launch_chrome(path, args)
 37. chromote:::with_random_port(...)
 42. chromote (local) startup(port = port, ...)
                                                                                                                                                                         
Ausführung angehalten

Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/

Steps to reproduce

No response

Expected behavior

webshot and webdhor 2 is installed
quarto install chromium run Okay,
Seperate google-chrome-stable_current_amd64.deb installed.
I am on debian 10, R 4.3.2 quarto version CLI 1.4.454

Actual behavior

No response

Your environment

No response

Quarto check output

No response

@Patrikios Patrikios added the bug Something isn't working label Jan 18, 2024
@mcanouil
Copy link
Collaborator

mcanouil commented Jan 18, 2024

Could you fill completely the template (in the appropriate sections) as we do really need to know "Steps to reproduce", "Your environment", and "Quarto check output"?

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
engine: knitr
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)
```

![A placeholder image](https://placehold.co/600x400.png)

The end.
````

@mcanouil mcanouil added the needs-repro Issues that are blocked until reporter provides an adequate reproduction label Jan 18, 2024
@cderv
Copy link
Collaborator

cderv commented Jan 18, 2024

Just some context.

When using some Plotly HTML output inside a document that will render to PDF, knitr will try to make a screenshot of the plotly graph using webshot or webshot2 (preferring websho2 as default if both are present).

From the error message I see, webshot2 is used, and for some reason it does not manage to connect to Chrome (it uses chromote for this) and so unable to make the screenshot.

This is a R issue - you should check that webshot2 is working on your environment.

I see you are using renv so you should check the version and see if updating would help.

@Patrikios
Copy link
Author

That would explain it @cderv as the linux 10 is a gui-less server, hence no virtual chorme windows can be opened, if that is how it works??

@cderv
Copy link
Collaborator

cderv commented Jan 19, 2024

chromote is a tool to communicate with chrome headless. So no need to open a visual within a browser window.

You can maybe try chromote directly to see if webshot2 would work on your environment See its doc at https://rstudio.github.io/chromote/

@cderv cderv added the third-party Issues involving interaction with a third-party library label Jan 19, 2024
@Patrikios
Copy link
Author

I think it has something to do with the proxy setting on the server.

@cderv
Copy link
Collaborator

cderv commented Jan 23, 2024

@jannismain
Copy link

Find a minimal reproduction here: https://github.com/jannismain/quarto-mermaid-pdf-issue

@cderv
Copy link
Collaborator

cderv commented Jan 30, 2024

@jannismain thanks for the example.

Is the issue you have directly related to this one ? It does not seem so as the error @Patrikios is getting is from R trying to connect to chrome.

In your case, you are using mermaid chunk which is a Quarto feature.

Also, if I follow the step to reproduce, I can produce the pdf file with mermaid graph

image

> quarto render example2.qmd
pandoc
  to: latex
  output-file: example2.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf

metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  title: Example with mermaid diagram


Rendering PDF
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode

running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode


Output created: example2.pdf

Please look for issues with Chrome and mermaid opened in the repo, and open a new one with your example and details about your environment. It will be best to get each issue in their own thread.

@cderv cderv changed the title Not possible to render HTML like mermaid or ploty in PDF Error with chromote R package when trying to render HTML like mermaid or ploty in PDF format Jan 30, 2024
@cderv cderv added the knitr label Jan 30, 2024
@jannismain
Copy link

@cderv thanks for checking out the example I provided. From the title of this issue, I thought they were related, but I will find a better place to discuss the issue I am experiencing 👍

@cderv
Copy link
Collaborator

cderv commented Jan 30, 2024

From the title of this issue, I thought they were related,

yeah I guess it right. That is why I tweaked the title of this issue

Copy link
Contributor

Thank you for using Quarto and reporting an issue!

Unfortunately, this issue is now considered stale because it has been opened since 14 days without providing a "working" reproducible example to help us investigate.
If you are still facing the issue, please review the "Bug Reports" guide on how to provide a fully reproducible example as a self-contained Quarto document or a link to a Git repository.
Without a reproducible example, it is unlikely that the issue will be addressed.

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)
```

The end.
````

@github-actions github-actions bot added the stale Issues open for 30+ days without providing a "working" reproducible example label Feb 14, 2024
@cscheid cscheid closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working knitr needs-repro Issues that are blocked until reporter provides an adequate reproduction stale Issues open for 30+ days without providing a "working" reproducible example third-party Issues involving interaction with a third-party library
Projects
None yet
Development

No branches or pull requests

5 participants