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 when running a tutorial #169

Closed
otuz1 opened this issue Jul 6, 2018 · 24 comments
Closed

error when running a tutorial #169

otuz1 opened this issue Jul 6, 2018 · 24 comments

Comments

@otuz1
Copy link

otuz1 commented Jul 6, 2018

I am new to R. I am trying to follow a tutorial for R.

After I load the learnr package with library(learnr), I try to run a tutorial with learnr::run_tutorial("hello", package="learnr"), I get the following error in my console:

Loading required package: shiny

Listening on http://127.0.0.1:5950
Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'font-awesome-4.5.0'; `directoryPath` = ''
  [No stack trace available]

At the same time a page is opened on http://127.0.0.1:5950/ displaying the following error:

ERROR: Couldn't normalize path in addResourcePath, with arguments: prefix = 'font-awesome-4.5.0'; directoryPath = ''

How can I fix this?

@profandyfield
Copy link

I have the same issue with my adventr package of tutorials. Had email from someone getting this same error. Based on some previous stuff I found I went to re-knit the html for each tutorial, but they're not running and I get the same error as above. Was working fine before I updated to R 3.5.1. I use these tutorials to teach so any help before september is very gratefully received.

Listening on http://127.0.0.1:7026
Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'font-awesome-4.5.0'; `directoryPath` = ''
  [No stack trace available]

sessionInfo:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

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

other attached packages:
 [1] WRS2_0.10-0            sjstats_0.16.0         lm.beta_1.5-1          Hmisc_4.1-1            Formula_1.2-3         
 [6] survival_2.42-3        lattice_0.20-35        gmodels_2.18.1         GGally_1.4.0           effects_4.0-2         
[11] effsize_0.7.1          car_3.0-0              carData_3.0-1          BayesFactor_0.9.12-4.2 Matrix_1.2-14         
[16] coda_0.19-1            robust_0.4-18          fit.models_0.5-14      forcats_0.3.0          stringr_1.3.1         
[21] dplyr_0.7.6            purrr_0.2.5            readr_1.1.1            tidyr_0.8.1            tibble_1.4.2          
[26] ggplot2_3.0.0          tidyverse_1.2.1        learnr_0.9.2.1        

loaded via a namespace (and not attached):
  [1] readxl_1.1.0        backports_1.1.2     plyr_1.8.4          lazyeval_0.2.1      TMB_1.7.14          splines_3.5.1      
  [7] TH.data_1.0-9       digest_0.6.15       htmltools_0.3.6     gdata_2.18.0        magrittr_1.5        checkmate_1.8.5    
 [13] cluster_2.0.7-1     openxlsx_4.1.0      modelr_0.1.2        sandwich_2.4-0      colorspace_1.3-2    rvest_0.3.2        
 [19] rrcov_1.4-4         haven_1.1.2         crayon_1.3.4        jsonlite_1.5        lme4_1.1-17         bindr_0.1.1        
 [25] zoo_1.8-2           glue_1.2.0          gtable_0.2.0        emmeans_1.2.2       MatrixModels_0.4-1  sjmisc_2.7.3       
 [31] DEoptimR_1.0-8      abind_1.4-5         scales_0.5.0        mvtnorm_1.0-8       Rcpp_0.12.17        xtable_1.8-2       
 [37] htmlTable_1.12      foreign_0.8-70      stats4_3.5.1        prediction_0.3.6    survey_3.33-2       htmlwidgets_1.2    
 [43] httr_1.3.1          RColorBrewer_1.1-2  acepack_1.4.1       modeltools_0.2-21   pkgconfig_2.0.1     reshape_0.8.7      
 [49] nnet_7.3-12         tidyselect_0.2.4    rlang_0.2.1         reshape2_1.4.3      later_0.7.3         munsell_0.5.0      
 [55] cellranger_1.1.0    tools_3.5.1         cli_1.0.0           sjlabelled_1.0.12   broom_0.4.5         ggridges_0.5.0     
 [61] evaluate_0.10.1     yaml_2.1.19         knitr_1.20          zip_1.0.0           robustbase_0.93-1   bindrcpp_0.2.2     
 [67] coin_1.2-2          pbapply_1.3-4       nlme_3.1-137        mime_0.5            xml2_1.2.0          compiler_3.5.1     
 [73] bayesplot_1.5.0     rstudioapi_0.7      curl_3.2            pcaPP_1.9-73        stringi_1.2.3       psych_1.8.4        
 [79] nloptr_1.0.4        markdown_0.8        stringdist_0.9.5.1  mc2d_0.1-18         pillar_1.2.3        pwr_1.2-2          
 [85] lmtest_0.9-36       estimability_1.3    data.table_1.11.4   httpuv_1.4.4.2      R6_2.2.2            latticeExtra_0.6-28
 [91] promises_1.0.1      gridExtra_2.3       rio_0.5.10          codetools_0.2-15    MASS_7.3-50         gtools_3.8.1       
 [97] assertthat_0.2.0    rprojroot_1.3-2     withr_2.1.2         mnormt_1.5-5        multcomp_1.4-8      parallel_3.5.1     
[103] hms_0.4.2           grid_3.5.1          rpart_4.1-13        glmmTMB_0.2.2.0     minqa_1.2.4         rmarkdown_1.10     
[109] snakecase_0.9.1     shiny_1.1.0         lubridate_1.7.4     base64enc_0.1-3   

@jjallaire
Copy link
Member

@rich-iannone It's possible that our update of font-awesome might have caused a problem here (although as far as I know re-knitting should always fix these types of errors). Could you try creating a tutorial with the older version of R Markdown that uses older Font Awesome then upgrading and see what happens?

@jcheng5 As far as I know re-knitting should fix this but @profandyfield reports that it didn't in his case.

@profandyfield
Copy link

I've just tried re-rendering a tutorial using rmarkdown version 1.9 and it renders fine - error is gone. Tried rendering the same tutorial under rmarkdown 1.10 and the error is back.

@jjallaire
Copy link
Member

@rich-iannone we should be able to repro this then. @profandyfield Can you provide a minimal version of the tutorial that repros the problem?

@profandyfield
Copy link

Ok, so while trying to create a stripped down version of one of the tutorials I discovered that if I re-render (rmarkdown 1.10) the tutorial without editing (which is what I had been doing because I don't need to edit them) then I get the error. If I edit (for example delete a character then type it again so that the .Rmd has to save before rendering) the error goes away and it renders. I tried on a different tutorial within the same package and exactly the same.

Are there any plans to stop the need to re-render (or indeed edit and re-render) every time R updates. I had a similar issue last time R updated - I had to manually re-render the 16 tutorials in my package so that they'd work for anyone using the most recent R. I mean, that's fine, but there are more productive ways to spend half and hour. Failing that, is there a way to batch render tutorials that are hosted within a package? (a sort of 'render all' command)?
thanks for your help BTW - really appreciate it.

@jjallaire
Copy link
Member

Ah, that makes perfect sense! (as we only re-render when the Rmd changes). Removing the .html file will also work.

What we really need to do is save the versions of all packages that we draw dependencies from and then automatically re-render when any of those versions changes.

@kevinushey
Copy link
Collaborator

FWIW I bumped into this when trying to re-render the sandbox tutorial .Rmd we have in the package for some local testing; deleting the old .html file within resolved the issue but that's not a particularly obvious solution.

@otuz1
Copy link
Author

otuz1 commented Jul 13, 2018

@profandyfield

I have the same issue with my adventr package of tutorials

I have read your book An adventure in statistics . The reason I stumbled on this issue is because I am trying to start the adventr tutorials.

Edit: I see that you committed new HTML files. It seems to work: thank you!

@profandyfield
Copy link

great - thanks for letting me know it now works! Hope you find the tutorials useful.

andy

@RodDalBen
Copy link

RodDalBen commented Jul 24, 2018

Hello all,
@profandyfield
I had the same problem described above, so I re-installed "adventr". However, I encountered another problem when trying to run tutorial 11:

> library(adventr)
> learnr::run_tutorial("adventr_11", package = "adventr")
Error: lexical error: invalid char in json text.
                                       <<<<<<< HEAD {"type":"list","at
                     (right here) ------^

Tutorials 1, 2, 3 works fine, but from 04 on the same error occur. How can I fix this?

@profandyfield
Copy link

I don't think this is a learnr issue, so I've reposted here

@lbcollins
Copy link

lbcollins commented Aug 2, 2018

@jjallaire Do you plan to commit re-rendered html using rmarkdown 1.10? I gather from the discussion above that this may solve the problem when running learnr::run_tutorial("hello", package="learnr") for those who have updated to R 3.5.1 and rmarkdown 1.10. Thanks.

@jjallaire
Copy link
Member

@schloerke Could you do this?

@schloerke
Copy link
Collaborator

@jjallaire Sure. I'll re-run the learnr tutorials and add a note in the news for others to do the same.

@schloerke
Copy link
Collaborator

I believe it involves more than just a re-render of the documents. As now users with rmarkdown v1.9 will have issues with pre-rendered rmarkdown v1.10 documents. (Confirmed on my machine.)

@jjallaire Is there any location in the shiny-prerendered output that contains the rmarkdown version, similar to how roxygen does with man files? If not, we could also look into having the rmarkdown version put into a meta field in the <head> of the html.

@jjallaire
Copy link
Member

@schloerke There isn't anywhere right, but there are lots of places where structured metadata is written so we should be able to accommodate that info. Here you can see we serialize the HTML dependencies for the document:

https://github.com/rstudio/learnr/blob/master/inst/tutorials/hello/hello.html#L68-L72

So there is a general mechanism for writing and reading JSON from within the HTML.

Incidentally, I think some of the problem with version instability is caused by the fact that when we save HTML dependencies we save the path to the dependency within the package (and that path in turn often includes a version number). I think to really root out all of these problems we need to be able to serialize dependencies in a way that's directory name independent.

@schloerke
Copy link
Collaborator

@jjallaire Have addressed the issue in rstudio/rmarkdown#1420.

Talking with @jcheng5 , we think it would be a good idea to inspect the document and force a new render if the utilized packages within the file are different from what the user has installed as well. Such as myPkg v1 was used in example 1 in the prerendered document, but the user as myPkg v2. I think it would be fair that the document should be rendered again.

Seem like a good check to add?

@jjallaire
Copy link
Member

I agree about re-rendering when the utilized packages change.

nestormontano added a commit to nestormontano/seeRtutoriales that referenced this issue Aug 10, 2018
ERROR: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'font-awesome-4.5.0'; `directoryPath` = ''

Intento 1, según lo visto en rstudio/learnr#169
yihui pushed a commit to rstudio/rmarkdown that referenced this issue Oct 8, 2018
@yihui
Copy link
Member

yihui commented Oct 8, 2018

The problem should be gone with devtools::install_github('rstudio/rmarkdown') (thanks @schloerke).

@schloerke
Copy link
Collaborator

devtools::install_github("rstudio/learnr") will also install the dev version of rmarkdown

@cadlam
Copy link

cadlam commented Jan 2, 2019

So I know this issue is closed, but I am having exactly the same problem as described by @otuz1 and @profandyfield when I try to load the "adventr" tutorials. I have the latest dev versions of rmarkdown and learnr. I'm really looking forward to the adventr tutorials and would appreciate a solution. Thanks!

@schloerke
Copy link
Collaborator

@cadlam Can you paste in your whole error message below? And also devtools::session_info()

@cadlam
Copy link

cadlam commented Jan 4, 2019

@schloerke My apologies it works now after restarting RStudio. Installing the dev version of learnr must have done the trick after all.

@schloerke
Copy link
Collaborator

Locking issue. Please open a new issue and reference this one in your description

@rstudio rstudio locked as resolved and limited conversation to collaborators Jan 4, 2019
yihui pushed a commit to RLesur/rmarkdown that referenced this issue Apr 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants