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

html_dependency not found with using mapview in knitr engine document #9058

Closed
cderv opened this issue Mar 13, 2024 · 6 comments
Closed

html_dependency not found with using mapview in knitr engine document #9058

cderv opened this issue Mar 13, 2024 · 6 comments
Assignees
Labels
knitr third-party Issues involving interaction with a third-party library

Comments

@cderv
Copy link
Collaborator

cderv commented Mar 13, 2024

@cderv Thanks for coming back to me.

I still have the problem. Here is an example:

---
title: Test Document
date: today
lang: de
execute: 
    echo: false
    warning: false
    cache: true
---

# un

```{r}
library(mapview)
mapview(breweries, layer.name = "T1")
```

# dos
```{r}
library(mapview)
mapview(breweries, layer.name = "T2")
```

# tres
```{r}
library(plainview)

mapview(poppendorf[[5]], legend = TRUE, layer.name = "T3")
```

I get the follwing error message from quarto render tt.qmd


processing file: tt.qmd
1/7                  
2/7 [unnamed-chunk-1]
3/7                  
4/7 [unnamed-chunk-2]
5/7                  
6/7 [unnamed-chunk-3]
7/7                  
output file: tt.knit.md

Error: path for html_dependency not found: /tmp/RtmpKYVffs/data_stars36b61bb1bcd_cf9035
Execution halted

R session info

> library(leaflet)
> library(leaflet.providers)
> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_CH.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_CH.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_CH.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Zurich
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] leaflet.providers_2.0.0 leaflet_2.2.1          

loaded via a namespace (and not attached):
 [1] htmlwidgets_1.6.4 compiler_4.3.3    magrittr_2.0.3    fastmap_1.1.1    
 [5] R6_2.5.1          cli_3.6.2         htmltools_0.5.7   crayon_1.5.2     
 [9] crosstalk_1.2.1   digest_0.6.35     rlang_1.1.3    

Originally posted by @michelk in #4149 (comment)

@cderv
Copy link
Collaborator Author

cderv commented Mar 13, 2024

Not sure what you mean with "fresh new session". I still get the error after deleting the cache files.

% rm -r tt_cache 
% rm -r tt_files 
% quarto render tt.qmd
    
    
    processing file: tt.qmd
    1/7                  
    2/7 [unnamed-chunk-1]
    3/7                  
    4/7 [unnamed-chunk-2]
    5/7                  
    6/7 [unnamed-chunk-3]
    7/7                  
    output file: tt.knit.md
    
    pandoc 
      to: html
      output-file: tt.html
      standalone: true
      section-divs: true
      html-math-method: mathjax
      wrap: none
      default-image-extension: png
      
    metadata
      document-css: false
      link-citations: true
      date-format: long
      lang: de
      title: Test Document
      date: today
      
    Output created: tt.html

% echo "# cuatro\nasdf" >> tt.qmd 
% quarto render tt.qmd           

    
    processing file: tt.qmd
    1/7                  
    2/7 [unnamed-chunk-1]
    3/7                  
    4/7 [unnamed-chunk-2]
    5/7                  
    6/7 [unnamed-chunk-3]
    7/7                  
    output file: tt.knit.md
    
    Error: path for html_dependency not found: /tmp/Rtmpg3beht/data_stars42be6bca06f7_425387
    Execution halted

Originally posted by @michelk in #4149 (comment)

@cderv cderv added needs-repro Issues that are blocked until reporter provides an adequate reproduction knitr labels Mar 13, 2024
@cderv
Copy link
Collaborator Author

cderv commented Mar 13, 2024

@michelk See this new issue so that we can discuss in a clean thread

As I mentioned in #4149 (comment), the issue from #4149 is fixed from third party package.

You may encounter another issue - I'll look into it with the new information your provided. Thanks

@cderv cderv self-assigned this Mar 13, 2024
@cderv
Copy link
Collaborator Author

cderv commented Mar 13, 2024

Ok I can reproduce now. This is related to caching, and this is not directly related to Quarto.

Here is a R Markdown document that will reproduce it too

---
title: Test Document
output: html_document
---

```{r}
library(mapview)
library(plainview)
```


```{r}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, cache = TRUE)
```

# un

```{r}
mapview(breweries, layer.name = "T1")
```

# dos
```{r}
mapview(breweries, layer.name = "T2")
```

# tres
```{r}
mapview(poppendorf[[5]], legend = TRUE, layer.name = "T3")
```

This is indeed related to #4149 for probably same cause in third party tool, but this time the problems comes from
This HTML dependency

List of 10
 $ name      : chr "T3_97f0bc"
 $ version   : chr "1"
 $ src       :List of 1
  ..$ file: chr "C:/Users/chris/AppData/Local/Temp/RtmpEF3n1f/data_stars8e04270e2a0_f3a72d"
 $ meta      : NULL
 $ script    :List of 1
  ..$ : chr "data_stars_T36c1e0d.txt"
 $ stylesheet: NULL
 $ head      : NULL
 $ attachment: NULL
 $ package   : NULL
 $ all_files : logi TRUE
 - attr(*, "class")= chr "html_dependency"

It uses a file in a temporary folder tied to a R session. This means it can be working when you cache the chunk.

This probably comes for mapview and they need to adapt so that cache is supported - or just disallow using the data in a cached chunk

They need to fix this so cache is supported - for now your workaround is not to cache the chunk.

Also FYI, you should not place library() calls and others with side effect in cached chunk - this could cause bad behavior as the chunks won't be re-run. More on this at https://bookdown.org/yihui/rmarkdown-cookbook/cache.html

Hope this helps !

@cderv
Copy link
Collaborator Author

cderv commented Mar 13, 2024

In fact it comes from leafem which is used by mapview

https://github.com/r-spatial/leafem/blob/6d6831352038b8f7462ff7afa698050c4e46fb5e/R/utils.R#L65-L80

@cderv
Copy link
Collaborator Author

cderv commented Mar 13, 2024

I opened in mapview

So I'll close this. Thanks for the report !

@cderv cderv closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@mcanouil mcanouil added third-party Issues involving interaction with a third-party library and removed needs-repro Issues that are blocked until reporter provides an adequate reproduction labels Mar 13, 2024
@michelk
Copy link

michelk commented Mar 13, 2024

@cderv Thanks a lot for the investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
knitr third-party Issues involving interaction with a third-party library
Projects
None yet
Development

No branches or pull requests

3 participants