ThinkR-open / golem

A Framework for Building Robust Shiny Apps
https://thinkr-open.github.io/golem/
Other
915 stars 133 forks source link

Remote dependencies not identified on shinyapps.io? #443

Closed seanhardison1 closed 4 years ago

seanhardison1 commented 4 years ago

Hi all,

My app requires the import of a package hosted on github to run, which I've included in my DESCRIPTION as follows:

Package: vcrshiny
Title: Visualizing Virginia Coast Reserve Data in Near Real-time
Version: 0.0.0.9000
Authors@R: 
    person(given = "Sean",
           family = "Hardison",
           role = c("aut", "cre"),
           email = "sh5rs@virginia.edu")
Description: The vcrshiny app is designed to query and visualize meteorological and tidal data from the Anheuser-Busch Coastal Research Center on the Eastern Shore of Virginia.
License: MIT + file LICENSE
Imports: 
    config,
    golem,
    shiny,
    processx,
    attempt,
    DT,
    glue,
    htmltools,
    dplyr,
    ggplot2,
    stringr,
    magrittr,
    lubridate,
    pkgload,
    shinythemes,
    dygraphs
Remotes: 
    jpshanno/tydygraphs
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.0
Suggests: 
    testthat
Depends: 
    R (>= 2.10)

However, when sending the app to shinyapps.io, the tydygraphs package is not installed and so the app fails. The app in question can be found here. Am I specifying Remotes: incorrectly?

The output of golem::add_dockerfile() also seems to ignore the remote package. Any ideas?

statnmap commented 4 years ago

You can retry after installing yourself locally, on your computer, the package from Github:
remotes::install_github("jpshanno/tydygraphs")

If you send the app on shinyapps.io using the blue button from the app.R file created by golem::add_shinyappsio_file(), this should work. It will look at which packages and which versions you installed on your computer.
If you installed this package locally, after a git pull for instance, this won't work because Rstudio sees the source as coming from your computer, and not from Github. Which is why I ask you to directly install from Github locally.

seanhardison1 commented 4 years ago

Thanks @statnmap. Do you know of anyway to check how Rstudio identifies where a package is coming from?

I reinstalled tydygraphs and sent the app to shinyapps.io using apps.R generated from golem::add_shinyappsio_file() without any luck. Deleting and recloning the repo and repeating the above steps didn't work either.

statnmap commented 4 years ago

Can you share the log file to see exactly the error ?

seanhardison1 commented 4 years ago

Sure.

```` 2020-06-10T14:04:13.155927+00:00 shinyapps[2238850]: Server version: 1.8.2.1-12 2020-06-10T14:04:13.155929+00:00 shinyapps[2238850]: LANG: en_US.UTF-8 2020-06-10T14:04:13.155970+00:00 shinyapps[2238850]: R version: 3.6.3 2020-06-10T14:04:13.155970+00:00 shinyapps[2238850]: httpuv version: 1.5.4 2020-06-10T14:04:13.155970+00:00 shinyapps[2238850]: shiny version: 1.4.0.2 2020-06-10T14:04:13.155971+00:00 shinyapps[2238850]: rmarkdown version: (none) 2020-06-10T14:04:13.155971+00:00 shinyapps[2238850]: knitr version: 1.28 2020-06-10T14:04:13.155971+00:00 shinyapps[2238850]: jsonlite version: 1.6.1 2020-06-10T14:04:13.155972+00:00 shinyapps[2238850]: RJSONIO version: (none) 2020-06-10T14:04:13.156029+00:00 shinyapps[2238850]: htmltools version: 0.4.0 2020-06-10T14:04:13.156418+00:00 shinyapps[2238850]: Using pandoc: /opt/connect/ext/pandoc2 2020-06-10T14:04:13.295620+00:00 shinyapps[2238850]: Using jsonlite for JSON processing 2020-06-10T14:04:13.303636+00:00 shinyapps[2238850]: 2020-06-10T14:04:13.303638+00:00 shinyapps[2238850]: Starting R with process ID: '41' 2020-06-10T14:04:13.610712+00:00 shinyapps[2238850]: Loading vcrshiny 2020-06-10T14:04:14.588195+00:00 shinyapps[2238850]: 2020-06-10T14:04:14.588197+00:00 shinyapps[2238850]: Listening on http://127.0.0.1:38775 2020-06-10T14:04:17.657195+00:00 shinyapps[2238850]: Failed to create bus connection: No such file or directory 2020-06-10T14:04:17.657685+00:00 shinyapps[2238850]: Warning in system("timedatectl", intern = TRUE) : 2020-06-10T14:04:17.657705+00:00 shinyapps[2238850]: running command 'timedatectl' had status 1 2020-06-10T14:04:17.913293+00:00 shinyapps[2238850]: Warning: Error in loadNamespace: there is no package called ‘tydygraphs’ 2020-06-10T14:04:17.918639+00:00 shinyapps[2238850]: 141: 2020-06-10T14:04:20.291365+00:00 shinyapps[2238850]: Warning: Error in loadNamespace: there is no package called ‘tydygraphs’ 2020-06-10T14:04:20.294829+00:00 shinyapps[2238850]: 141: 2020-06-10T14:04:20.443122+00:00 shinyapps[2238850]: Warning: Error in loadNamespace: there is no package called ‘tydygraphs’ 2020-06-10T14:04:20.446541+00:00 shinyapps[2238850]: 141: ````

The app opens as expected, but gives the error when rendering the tydygraph. Each new error above is created after making a selection in a dropdown menu to update the figure.

ColinFay commented 4 years ago

Hey,

I think the issue might be that you didn't specify the package in the Import also.

When adding a remote dep, you should create a Remotes entry in the DESCRIPTION + add the package inside the Imports.

A shorthand for doing it is to use usethis::use_dev_package, that will plug the two at the correct location inside your DESCRIPTION.

seanhardison1 commented 4 years ago

That solved it!! Thank you @statnmap and @ColinFay

ColinFay commented 4 years ago

Ah, I made the PR before I saw your comment! Feel free to close it