Shinyapps.io Deploy error: there is no package called 'gradethis'

I'm attempting to deploy a learnr RMarkdown tutorial to shinyapps.io and am getting the following error:

processing file: Untitled.Rmd
Quitting from lines 8-16 (Untitled.Rmd) 
Error in value[[3L]](cond) : there is no package called 'gradethis'
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Those lines include the library(gradethis) command. Here's what my Deploy tab says:

----- Deployment log started at  2020-09-06 17:37:52  -----
Deploy command: 
 rsconnect::deployApp(appDir = "~/Dropbox/Work/Teaching/College of William and Mary/Fall 2020/Labs/wmbiofall2020/Untitled",      appFileManifest = "/var/folders/k0/n_7n3thj4h35pzp_ppnm3_l00000gp/T/f1f4-c31f-964d-eb00",      appPrimaryDoc = "Untitled.Rmd", appSourceDoc = "~/Dropbox/Work/Teaching/College of William and Mary/Fall 2020/Labs/wmbiofall2020/Untitled/Untitled.Rmd",      account = "mdllama", server = "shinyapps.io", appName = "Untitled",      appId = 2762068, launch.browser = function(url) {         message("Deployment completed: ", url)     }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE),      logLevel = "verbose") 

Session information: 
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

loaded via a namespace (and not attached):
[1] compiler_4.0.2        rsconnect_0.8.16-9001
Cookies: 
[1] "None"
GET /v1/applications/2762068 134ms
----- Bundle upload started at  2020-09-06 17:37:52  -----
[2020-09-06 17:37:52] Inferring App mode and parameters 
[2020-09-06 17:37:52] Bundling app dir 
[2020-09-06 17:37:52] Generate manifest.json 
[2020-09-06 17:37:56] Writing Rmd index if necessary 
[2020-09-06 17:37:56] Compressing the bundle 
POST /v1/bundles 138ms
[2020-09-06 17:37:56] Starting upload now 
PUT /bundles/application-2762068/e83ce28ccfc24f00972535391496321d.tar.gz?AWSAccessKeyId=ASIA54P7SCTKWQHHOCW2&x-amz-acl=bucket-owner-full-control&Expires=1599431876&content-md5=V0URhb38dJYfS%2BsIfTo8JA%3D%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEPr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCIEZ7DlkNmu3qqVPE1ywQ667Y1rNrbgCIgVOydKqeRTuOAiBkUuXWWGH9jIe82QrpXllXayeEM%2BDYyz%2FAxF8ArWm0GCq9Awjy%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDk1NDU1NTU2OTM2NSIMsOecJnt%2FzLb8747vKpEDTw4VmztFregj%2FRhrfkR6c7IrlVsYtPC4%2Bv8xIH4Br%2BfOgSjO5hYz8Kaf11spmvhUyiH6N%2FvQJvKPycCtvMr2vV6pIWXCFfEYCENXO7yZivkAmWrNT%2Fqya29pT025s1lwY2vSY3j9jOK9WuhoW45oh9f7h0UPYOkfxHMUjeYkecrI5LW%2FQuXLHfdAdA%2FYI55ALqkIkP7bQ%2BGN01EyNBDssUnqRBnR3x7AEf4bJUPQvk8qPp0hrSypskDk1Ue1u8%2BGxTkPSoYrUAyjxINPMgO6UhjB%2F%2BXI5k8khe%2F%2Bl0ZZ9T%2BsIuWvTNN3AHVxzoMzrvdpdCc2pavGLeaoWwUeSdIwHCd0YMii2Ft16oa4S3SBwYnmwrcdYV%2B3sKQKAHAiekHiQWaKNa3vPKY1BpNdaATUlEJeyJfW%2B5YoS8iXQcF2prnW%2FtCQHmIsaELoABziXntcQRJcNWF1UVOvSvCZl43hUkQHXLyr1%2F%2F4V%2Bo8Y9kGWTg%2BRvrRnBe0hMZkhyB%2B4UpQCCIb22ym4KMemLxHPJ9IIK8whrPU%2BgU67AFPyFnGpvVfvSxLMIYKHN%2BwCNZDlh0%2F3eh1P9RFz7r00IzHVzprR1V7tmAAppr90925G3KAjKQSQnXtcYgdIvAt7Y2MQoIeExtO6ehQuSzf%2F9ojb5r3G8BLtpD%2FSw44qp9woksYTiz85ug6s0%2B0J3L4KhKO8ZMpcujBp3e%2FbAvU7XeBA0gHZTDwk1YeGtAsTUz5IBqjt0q%2Fr6ka4yng2Ag2Ejffd3utAUhh2xUoEN%2FCNzWWuxtRU2lEfHAhCN5rFYnaurbr8IPQIfGuzLAxP4QH98wULKoaeKSVx7c%2FZzUozBqtjWEjoVQ%2BeZLfow%3D%3D&Signature=T4sPpfn%2F1O8DOmqoj9G3VtQpb88%3D&content-type=application%2Fx-tar 229ms
[2020-09-06 17:37:57] Upload complete 
POST /v1/bundles/3600078/status 135ms
GET /v1/bundles/3600078 111ms
[2020-09-06 17:37:57] Saving deployment record for Untitled -  
----- Server deployment started at  2020-09-06 17:37:57  -----
POST /v1/applications/2762068/deploy 295ms
Waiting for task: 786430704
GET /v1/tasks/786430704 110ms
GET /v1/tasks/786430704 113ms
  building: Parsing manifest
GET /v1/tasks/786430704 112ms
  building: Building image: 4029754
GET /v1/tasks/786430704 112ms
  building: Installing packages
GET /v1/tasks/786430704 118ms
GET /v1/tasks/786430704 109ms
GET /v1/tasks/786430704 109ms
GET /v1/tasks/786430704 122ms
GET /v1/tasks/786430704 113ms
GET /v1/tasks/786430704 110ms
GET /v1/tasks/786430704 112ms
GET /v1/tasks/786430704 123ms
GET /v1/tasks/786430704 125ms
GET /v1/tasks/786430704 112ms
GET /v1/tasks/786430704 106ms
GET /v1/tasks/786430704 112ms
GET /v1/tasks/786430704 121ms
GET /v1/tasks/786430704 108ms
GET /v1/tasks/786430704 147ms
GET /v1/tasks/786430704 112ms
GET /v1/tasks/786430704 115ms
GET /v1/tasks/786430704 108ms
GET /v1/tasks/786430704 117ms
  building: Installing files
GET /v1/tasks/786430704 106ms
GET /v1/tasks/786430704 125ms
GET /v1/tasks/786430704 109ms
  building: Pushing image: 4029754
GET /v1/tasks/786430704 106ms
GET /v1/tasks/786430704 106ms
GET /v1/tasks/786430704 123ms
GET /v1/tasks/786430704 140ms
GET /v1/tasks/786430704 113ms
GET /v1/tasks/786430704 118ms
GET /v1/tasks/786430704 112ms
GET /v1/tasks/786430704 117ms
GET /v1/tasks/786430704 118ms
GET /v1/tasks/786430704 153ms
GET /v1/tasks/786430704 114ms
GET /v1/tasks/786430704 107ms
GET /v1/tasks/786430704 109ms
GET /v1/tasks/786430704 108ms
GET /v1/tasks/786430704 194ms
GET /v1/tasks/786430704 118ms
GET /v1/tasks/786430704 109ms
GET /v1/tasks/786430704 153ms
GET /v1/tasks/786430704 121ms
GET /v1/tasks/786430704 109ms
  deploying: Starting instances
GET /v1/tasks/786430704 109ms
GET /v1/tasks/786430704 111ms
GET /v1/tasks/786430704 118ms
  rollforward: Activating new instances
GET /v1/tasks/786430704 131ms
  terminating: Stopping old instances
GET /v1/tasks/786430704 111ms
GET /v1/tasks/786430704 108ms
GET /v1/tasks/786430704 137ms
----- Deployment log finished at  2020-09-06 17:38:56  -----
Deployment completed: https://mdllama.shinyapps.io/Untitled/
Warning message:
In fileDependencies.R(tempfile) :
  Failed to parse /var/folders/k0/n_7n3thj4h35pzp_ppnm3_l00000gp/T//RtmpSJcEwb/filef58a7b8b2635 ; dependencies in this file will not be discovered.

The warning message about fileDependencies.R seems to me to be the red flag. I have installed the learnr package using install.packages and the gradethis package using devtools::install_github("rstudio-education/gradethis"). This issue has similarities to this other deployment error thread, but I think this issue is specific to the learnr and gradethis package.

To illustrate, here is the tutorial - it is basically just the Interactive Tutorial Template with some small changes. I've changed the first chunk from

library(learnr)
knitr::opts_chunk$set(echo = FALSE)

to

library(learnr)
library(gradethis)
learnr::tutorial_options(
  exercise.timelimit = 15,
  exercise.checker = gradethis::grade_learnr,
  exercise.eval = FALSE
)
knitr::opts_chunk$set(echo = FALSE)

So far, this doesn't break deployment to shinyapps.io. However, if I change the R-chunk hint from

head(mtcars)

to

head(___)

deployment to shinyapps.io fails with the first error message mentioned above. It seems to me the problem is hint chunks (or exercise chunks with exercise.eval=FALSE) that have a syntax error in them, even though on knitting these don't get evaluated. I'd like to use ___ to denote areas where learners can see where code should be inserted, but the fact that this is incorrect R syntax makes this problematic. Any workarounds for this?

Thanks!

1 Like

You need to install the gradethis package from github. You can find it at https://github.com/rstudio-education/gradethis

Thanks for responding, @andrie. I did install it from github using devtools::install_github("rstudio-education/gradethis"). In my post I mentioned that deployment works by making sure that the hint chunk doesn't have any R syntax errors. I wanted to use ___ to denote where code should be inserted in the code editor (sort of a partial solution to the exercise), but it seems like the deployment error occurs when an R-chunk has a syntax error (which happens when ___ is inserted), even though that R-chunk will not be evaluated on knit (which is the case for hints and exercises that have exercise.eval=FALSE.

I don't have a solution, but wanted to mention that I am experiencing the exact same issue.

Do you have any R chunks that are learnr hints or solutions that are showing syntax errors in R Markdown? That was the issue for me. I have exercise.eval=FALSE set using learnr::tutorial_options, so I know the hints and solution chunks aren't being evaluated on knit. Still, once I make them free of R syntax errors, it seems to fix the issue, oddly enough.

Edit: Pinging @Debbie_Yuster just in case!

Holy cow, I finally got it to work! Here are the steps I took:

  1. Install the dev version of packrat:
    devtools::install_github("rstudio/packrat")
  2. Reinstall gradethis using devtools:
    devtools::install_github("rstudio-education/gradethis", force = TRUE)
  3. Not sure if I loaded packrat in the console, I don't see it in my history...couldn't hurt though?
  4. Rerun the Rmd document to render the tutorial
  5. Republish to shinyapps.io

Perhaps some of this is extraneous - but it worked for me. Hope it works for you too!

P.S. This post tipped me off to packrat.
P.P.S. Apparently packrat is "soft-deprecated" and superceded by renv. But I didn't get anywhere with that, so...

1 Like

Hi @mdlama, yes, I had fill-in-the-blank exercises, just like you. I'm sure this was the issue. Try my solution and let me know if it worked! I'll be really happy if it helped both of us.

Woohoo! It worked for me too! Thanks, @Debbie_Yuster! Gonna mark this as solved...

1 Like

This has been answered already, but for those internet travelers finding this page, I wanted to point out that this issue is indeed mentioned in the learnr documentation under Security Considerations: Deployment Dependencies Not Found. I, uh, didn't read that part of the documentation until now. :grimacing:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.