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

shinyapps.io issues #29

Open
lecy opened this issue Oct 11, 2019 · 12 comments
Open

shinyapps.io issues #29

lecy opened this issue Oct 11, 2019 · 12 comments

Comments

@lecy
Copy link
Collaborator

lecy commented Oct 11, 2019

I'm migrating the shinyapps.io issue to a new ticket.

When trying to deploy the app, I get the message: ERROR: An error has occurred. Check your logs or contact the app author for clarification. It is showing up in the viewer, in R, but not in Shinyapps.

Originally posted by @RickyDuran in #27 (comment)

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

Ricky, is that while running the app, or publishing on shinyapps.io?

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

There is a discussion about the error message here:

https://stackoverflow.com/questions/47727806/error-an-error-has-occurred-check-your-logs-or-contact-the-app-author-for-clar?rq=1

Did you install any packages from GitHub? If they are still in development phase that version will not yet be on CRAN.

I suspect when you upload an app to shinyapp.io it will create a new server partition for you with R installed, then install all of the packages required for your app from the CRAN. If it can't find the package it will give this error.

@castower
Copy link

castower commented Oct 11, 2019

Hello all, I have tried many times to get my .rmd file uploaded to Shinyapp.io, but it simply won't upload. I was able to get a detailed output of what's wrong and it seems to be something with Knitr, but I have no idea what to do with that....

here is the output:

----- Deployment log started at  2019-10-11 03:17:07  -----
Deploy command: 
 rsconnect::deployApp(appDir = "~/Documents/ASU/Fall 2019/CPP 526",      appFileManifest = "/var/folders/xq/pbc8kv2n6_nbnhwjhy0483zh0000gn/T/f518-db45-b050-48b3",      appPrimaryDoc = "Code-Through-Project-Stowers.Rmd", appSourceDoc = "~/Documents/ASU/Fall 2019/CPP 526/Code-Through-Project-Stowers.Rmd",      account = "castower", server = "shinyapps.io", appName = "Code-Through-Project-Stowers",      appId = 1317344, launch.browser = function(url) {         message("Deployment completed: ", url)     }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE),      logLevel = "verbose") 

Session information: 
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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_3.6.1   rsconnect_0.8.15
Cookies: 
[1] "None"
GET /v1/applications/1317344 1561ms
----- Bundle upload started at  2019-10-11 03:17:09  -----
[2019-10-11 03:17:09] Inferring App mode and parameters 
[2019-10-11 03:17:09] Bundling app dir 
[2019-10-11 03:17:10] Generate manifest.json 
[2019-10-11 03:18:18] Writing Rmd index if necessary 
[2019-10-11 03:18:18] Compressing the bundle 
POST /v1/bundles 1115ms
[2019-10-11 03:18:19] Starting upload now 
[2019-10-11 03:18:21] Upload complete 
POST /v1/bundles/2490652/status 594ms
GET /v1/bundles/2490652 573ms
[2019-10-11 03:18:22] Saving deployment record for Code-Through-Project-Stowers -  
----- Server deployment started at  2019-10-11 03:18:22  -----
POST /v1/applications/1317344/deploy 763ms
Waiting for task: 657075928
GET /v1/tasks/657075928 554ms
  building: Processing bundle: 2490652
GET /v1/tasks/657075928 618ms
  building: Parsing manifest
GET /v1/tasks/657075928 609ms
  building: Building image: 2680343
GET /v1/tasks/657075928 647ms
  building: Installing system dependencies
GET /v1/tasks/657075928 555ms
GET /v1/tasks/657075928 548ms
GET /v1/tasks/657075928 552ms
GET /v1/tasks/657075928 638ms
  building: Fetching packages
GET /v1/tasks/657075928 980ms
  error: Building package: knitr
################################ Begin Task Log ################################ 
GET /v1/tasks/657075928/logs/ 564ms
GET /v1/tasks/?filter=account_id:323453&filter=parent_id:657075928&count=100&offset=0 566ms
GET /v1/tasks/657075929/logs/ 573ms
[2019-10-11T10:18:28.886256269+0000] Execute script: packages/build/sys.sh
+ set -e
+ apt-get update -qq
+ apt-get install -y libapparmor-dev
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  libapparmor-dev
0 upgraded, 1 newly installed, 0 to remove and 72 not upgraded.
Need to get 67.8 kB of archives.
After this operation, 229 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapparmor-dev amd64 2.10.95-0ubuntu2.11 [67.8 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 67.8 kB in 0s (0 B/s)
Selecting previously unselected package libapparmor-dev:amd64.
(Reading database ... 119718 files and directories currently installed.)
Preparing to unpack .../libapparmor-dev_2.10.95-0ubuntu2.11_amd64.deb ...
Unpacking libapparmor-dev:amd64 (2.10.95-0ubuntu2.11) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libapparmor-dev:amd64 (2.10.95-0ubuntu2.11) ...
GET /v1/tasks/?filter=account_id:323453&filter=parent_id:657075929&count=100&offset=0 549ms
################################# End Task Log ################################# 
----- Deployment error -----
Error: Unhandled Exception: Child Task 657075929 failed: Error building image: Error fetching knitr (1.25.1) source. <CRANPackageSource repo='http://cran.rstudio.org'> unable to satisfy package: knitr (1.25.1)
 
----- Error stack trace -----
3: stop(status$error, call. = FALSE)
2: client$waitForTask(taskId, quiet)
1: rsconnect::deployApp(appDir = "~/Documents/ASU/Fall 2019/CPP 526", 
       appFileManifest = "/var/folders/xq/pbc8kv2n6_nbnhwjhy0483zh0000gn/T/f518-db45-b050-48b3", 
       appPrimaryDoc = "Code-Through-Project-Stowers.Rmd", appSourceDoc = "~/Documents/ASU/Fall 2019/CPP 526/Code-Through-Project-Stowers.Rmd", 
       account = "castower", server = "shinyapps.io", appName = "Code-Through-Project-Stowers", 
       appId = 1317344, launch.browser = function(url) {
           message("Deployment completed: ", url)
       }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE), 
       logLevel = "verbose")
Error: Unhandled Exception: Child Task 657075929 failed: Error building image: Error fetching knitr (1.25.1) source. <CRANPackageSource repo='http://cran.rstudio.org'> unable to satisfy package: knitr (1.25.1)
In addition: There were 12 warnings (use warnings() to see them)
Execution halted

I have tried to type warnings() into my console, but it doesn't produce anything.

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

It looks like you have a developer's version of knitr. Try installing the older version:

require( devtools )
install_version( "knitr", version = "1.25", repos = "http://cran.us.r-project.org" )

@castower
Copy link

castower commented Oct 11, 2019

It looks like you have a developer's version of knitr. Try installing the older version:

require( devtools )
install_version( "knitr", version = "1.25", repos = "http://cran.us.r-project.org" )

That fixed it! However, I am now getting the same error as Ricky. Likely because my waffle package does come from github: https://github.com/hrbrmstr/waffle. Does that mean that there isn't a way for me to deploy my file?

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

This R Studio discussion board says you should be able to:

I've run into instances of this as well. When deploying, make sure to have your GitHub package installed from GitHub ( devtools::install_github() ), not installed from a local folder (devtools::install()). When installed from GitHub, devtools will store the GitHub location and hash for shinyapps to download. (If installed from a local folder, there is no location to download from.)

How did you install your GitHub package?

@castower
Copy link

castower commented Oct 11, 2019

This R Studio discussion board says you should be able to:

I've run into instances of this as well. When deploying, make sure to have your GitHub package installed from GitHub ( devtools::install_github() ), not installed from a local folder (devtools::install()). When installed from GitHub, devtools will store the GitHub location and hash for shinyapps to download. (If installed from a local folder, there is no location to download from.)

How did you install your GitHub package?

I removed the package and then re-installed using the devtools::install_github() option and it's now working!

@RickyDuran
Copy link

The only thing that may have been installed, was htmltools, but it kept prompting me to install, but would say it couldn't install. I restarted and the and it stopped promting to install. Not sure if it was installed afterall or not. The version I have is 0.4.0.

@RickyDuran
Copy link

FINALLY! Thanks @castower ! That helped!
Remove Knitr
use to install from github: 'devtools::install_github("yihui/knitr", force = TRUE)'
removed 'library(knitr)' from code

@castower
Copy link

FINALLY! Thanks @castower ! That helped!
Remove Knitr
use to install from github: 'devtools::install_github("yihui/knitr", force = TRUE)'
removed 'library(knitr)' from code

@RickyDuran glad that helped, it was such a frustrating error!

To clarify all of my steps to solve my problem for anyone else that may read this:

First, I uninstalled and reinstalled knitr using:

remove.packages("knitr")
require( devtools )
install_version( "knitr", version = "1.25", repos = "http://cran.us.r-project.org" )

As a note, I did leave

library(knitr)

in my file and it didn't cause any problems.

Next, to stop the error message that was produced by my waffle package:

ERROR: An error has occurred. Check your logs or contact the app author for clarification.

I also uninstalled and re-installed, but this time instead of using the first install option that was listed on the GitHub page:

install.packages("waffle", repos = "https://cinc.rud.is")

I selected the devtools::install_github() option:

remove.packages("waffle")
devtools::install_github("hrbrmstr/waffle")

During the download from install_github() it indicated that it was importing the repos info. As noted in the linked R Studio Discussion Board, this is key so that shinyapps can find the necessary info. By default, it only searches CRAN and not GitHub.

I found some helpful readings on this here: rstudio/rsconnect#88 and in section 2.4.0.1 here: https://docs.rstudio.com/shinyapps.io/getting-started.html#managing-r-versions

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

Thank you both for sharing your steps!

@lecy
Copy link
Collaborator Author

lecy commented Oct 11, 2019

And just to note that Shiny Apps are fairly cutting edge.

As I mentioned in the lecture notes, R has figured out a way to replace full-stack development of web apps, which requires six or seven different languages and a live server, with these translational shiny widgets and render functions, and integration to a server through shinyapps.io.

You can see the progression to the frontiers and wilderness of open source development.

Core R --> very stable and predictable

Popular packages (dplyr) --> often easier to use and poweful, usually very stable and reliable but syntax is distinct from Core R

Custom niche packages --> usually cool, but sometimes have issues with dependencies

Fully customized platform development (shiny apps) --> usually some work making sure all of the part are playing nicely together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants