Error loading rmarkdown document after time period on shiny server - r

Cleaning up this question (https://stackoverflow.com/questions/36564482/multiple-rmarkdown-files-on-shiny-server)
I am trying to deploy .Rmd files on a shiny server. This works at first i.e. when I first load the page everything loads correctly. It even loads two or three times. However, eventually it stops working and I get this error:
path[1]="/tmp/Rtmpcmbz6g/widgetbinding19405f628a16": No such file or directory
If I save the file in a new directory, it works again for a while then fails. The head of my .Rmd document looks like this:
---
output:
html_document:
toc: true
toc_float: true
---
In the document I import data from elsewhere on the server:
```{r, include=FALSE}
ERF <- 1001
ws <- paste("/media/erf_data/ERF",ERF,"/raw_data", sep="")
setwd(ws)
tdata <- paste("ERF", ERF, "_Transistor.csv", sep="")
tran <- read.csv(tdata)
```
This is my sessioninfo:
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 LTS
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.1 dplyr_0.4.3 gridExtra_2.0.0 scales_0.3.0
[5] nlme_3.1-126 plyr_1.8.3 ggthemes_2.2.1 ggplot2_1.0.1
[9] splitstackshape_1.4.2 data.table_1.9.6 sqldf_0.4-10 RSQLite_1.0.0
[13] gsubfn_0.6-6 proto_0.3-10 RMySQL_0.10.7 DBI_0.3.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 formatR_1.2.1 tools_3.2.4 digest_0.6.8 jsonlite_0.9.19
[6] gtable_0.1.2 lattice_0.20-33 yaml_2.1.13 parallel_3.2.4 stringr_1.0.0
[11] knitr_1.11 htmlwidgets_0.5 R6_2.1.1 tcltk_3.2.4 rmarkdown_0.9.5
[16] reshape2_1.4.1 magrittr_1.5 htmltools_0.3 MASS_7.3-44 assertthat_0.1
[21] colorspace_1.2-6 labeling_0.3 stringi_1.0-1 lazyeval_0.1.10 munsell_0.4.2
[26] chron_2.3-47
Is there any more information I can provide that will help me find a solution to this?

I got this error, too.
It happens when I am hyperlinking a Shiny App page from a Rmd page.
It works fine before you click on that hyperlink. After one click, the Rmd page will stop working giving me errors similar to yours.
The fix I found is to edit your Rmd file and save.
This seems to make Rmd refresh on the Shiny Server and solve this issue.
However, if you still want to hyperlink it, it will stop working the moment you click on it.

This may seem like a diff between server session timeout and caching. What's your configuration on this?

Related

Rhandsontable displays on a locally deployed app, but not on app displayed in AWS EC2 Ubuntu 18.04 server

I'm trying to deploy on a private server an app that allows me to edit an RHandsontable object. For privacy reasons I cannot be showing a demonstration here.
I have successfully tested my app locally, but when I deploy it on my server the RHandsontable doesn't display, and the app "screen goes gray" after I start interacting there, so it doesn't allow any further interactions there.
This is how it looks on my Windows 10 browser. You can even see a 2 rhandsontables (that are empty because it has no selection whatsoever), that can be edited. The "Guardar" button is currently a dummy.
This is how it looks on AWS Ubuntu 18.04 Shiny Server. No rhandsontable loads (though the button loads). Same script, just different directories. I verified that the data loaded into both shiny apps were the same. You can also appreciate that the dummy button "Guardar" still appears.
I tried the same rendering equivalent data.tables from both the shiny and DT packages, leading to the same results as shown above.
Also, when I check my server logs at /var/log/shiny-server/ no issue arises (eg.: missing packages, broken code, etc). Last log goes as follows:
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Attaching package: ‘DT’
The following objects are masked from ‘package:shiny’:
dataTableOutput, renderDataTable
Listening on http://127.0.0.1:41757
This suggests me that I have a compatibility / interaction issue that arises in Shiny Server or in Ubuntu that doesn't arise in my PC.
I have seen different sources in Stack Overflow and in jrowen's GitHub page without any success, and I'd like to know if I'm missing anything.
There's a minor difference between R version between both machines (my Ubuntu VM is fresh, so some packages are updated). This could also cause a problem, but I'm not positive this could be the reason.
I also installed JRE on both instances (I also thought this could be caused due to a Java issue that I haven't fixed properly). Running java -version on my VM yields
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
My personal computer is a Windows 10 Machine. Details:
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.1.0 lubridate_1.7.4 mailR_0.4.1 forcats_0.3.0
[5] stringr_1.3.1 purrr_0.2.5 readr_1.1.1 tidyr_0.8.1
[9] tibble_2.0.1 ggplot2_3.0.0.9000 tidyverse_1.2.1 DBI_1.0.0
[13] RODBC_1.3-15 DT_0.4 rhandsontable_0.3.7 Cairo_1.5-9
[17] openxlsx_4.1.0 knitr_1.20 dplyr_0.8.0.1 shiny_1.1.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 lattice_0.20-35 assertthat_0.2.0 digest_0.6.15 mime_0.5
[6] R6_2.2.2 cellranger_1.1.0 plyr_1.8.4 backports_1.1.2 evaluate_0.10.1
[11] httr_1.3.1 highr_0.7 pillar_1.3.1 rlang_0.3.1 lazyeval_0.2.1
[16] rstudioapi_0.7 R.oo_1.22.0 R.utils_2.8.0 rmarkdown_1.11 htmlwidgets_1.2
[21] munsell_0.5.0 broom_0.5.0 compiler_3.5.0 httpuv_1.4.4.1 modelr_0.1.2
[26] pkgconfig_2.0.2 htmltools_0.3.6 tidyselect_0.2.5 crayon_1.3.4 withr_2.1.2
[31] later_0.7.3 R.methodsS3_1.7.1 grid_3.5.0 nlme_3.1-137 jsonlite_1.5
[36] xtable_1.8-2 gtable_0.2.0 magrittr_1.5 scales_0.5.0 zip_1.0.0
[41] cli_1.0.1 stringi_1.1.7 promises_1.0.1 xml2_1.2.0 tools_3.5.0
[46] glue_1.3.0 hms_0.4.2 rsconnect_0.8.12 yaml_2.1.19 colorspace_1.3-2
[51] rvest_0.3.2 rJava_0.9-10 haven_1.1.2
The Ubuntu 18.04 machine goes as follows:
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.3.1 DT_0.5 rhandsontable_0.3.7
[4] knitr_1.22 shiny_1.2.0 dplyr_0.8.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 xtable_1.8-3
[5] R6_2.4.0 rlang_0.3.3 tools_3.5.3 xfun_0.5
[9] htmltools_0.3.6 assertthat_0.2.1 digest_0.6.18 tibble_2.1.1
[13] crayon_1.3.4 purrr_0.3.2 later_0.8.0 htmlwidgets_1.3
[17] promises_1.0.1 glue_1.3.1 mime_0.6 cellranger_1.1.0
[21] compiler_3.5.3 pillar_1.3.1 jsonlite_1.6 httpuv_1.5.0
[25] pkgconfig_2.0.2
In advance, thanks very much for your help. Please clarify at comments if you need any extra information (that I can provide).
Edit: I checked as well outputting data.tables instead of rhandsontables both locally and on Ubuntu and failed as well rendering only on my Ubuntu VM.
For anyone interested in my problem, it was actually related to a firewall issue, not to a server-side or compatibility issue.
When I accessed my application from a network that wasn't my organization's (i.e. my cell phone's shared internet or home network) I had no problem at all.

Error on shiny server ERROR: 'restoreInput' is not an exported object from 'namespace:shiny'

I'm trying to run a shiny app that works perfectly well when I run it locally but not when I try and run it on a shiny web server. When I try and access it through the browser all I get is the following error message:
ERROR: 'restoreInput' is not an exported object from 'namespace:shiny'
I'm aware that a question regarding this error message has previously been asked here: Shinydashboard: 'restoreInput' is not an exported object from 'namespace:shiny' but I believe that person was running the app locally so my question is distinct from their's. Nevertheless I have obviously tried to implement all of the solutions provided for that answer which are basically just "ensure you have the latest version of R and the latest version of the required packages". I've done this and when I ssh into the shiny server and source my ui and server scripts and then call sessionInfo() this is the output:
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinydashboard_0.6.1 shinythemes_1.1.1 ggplot2_2.2.1
[4] raster_2.6-7 sp_1.2-7 leaflet_1.1.0
[7] shiny_1.0.5
loaded via a namespace (and not attached):
[1] Rcpp_0.12.15 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2
[5] xtable_1.8-2 lattice_0.20-35 R6_2.2.2 rlang_0.2.0
[9] plyr_1.8.4 grid_3.4.3 gtable_0.2.0 htmltools_0.3.6
[13] crosstalk_1.0.0 yaml_2.1.17 lazyeval_0.2.1 digest_0.6.15
[17] tibble_1.4.2 htmlwidgets_1.0 mime_0.5 compiler_3.4.3
[21] pillar_1.2.1 scales_0.5.0 httpuv_1.3.6.1
which is almost identical to the output I get when I call sessionInfo() in my local version of R in which the app runs seamlessly. See below:
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shinydashboard_0.6.1 shinythemes_1.1.1 ggplot2_2.2.1 raster_2.6-7
[5] sp_1.2-6 leaflet_1.1.0 shiny_1.0.5
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2 xtable_1.8-2
[6] lattice_0.20-35 R6_2.2.2 rlang_0.1.2 plyr_1.8.4 tools_3.4.3
[11] rgdal_1.2-16 grid_3.4.3 gtable_0.2.0 rgeos_0.3-26 htmltools_0.3.6
[16] crosstalk_1.0.0 yaml_2.1.14 lazyeval_0.2.1 digest_0.6.14 tibble_1.3.4
[21] htmlwidgets_0.9 rsconnect_0.8.5 mime_0.5 compiler_3.4.3 scales_0.5.0
[26] jsonlite_1.5 httpuv_1.3.5
What's particularly strange is that initially when I ssh-ed into the shiny server and sourced the ui.R file I was getting this same error message. After updating R and all the packages this doesn't happen anymore but I still get the same error when I try and open the app in the browser. I added the following lines to the start of both my server and ui scripts to ensure that it was using the correct version of R and the up-to-date packages.
loc <- '/path/to/location/of/correct/r/packages'
.libPaths(c(loc, .libPaths()))
Can anybody advise me as to what might be going on or how best to troubleshoot?

Installing caret for R. nlopt linux install error

I am new to linux and struggling with installing caret for R. I am receiving the following error during the caret install process.
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/gtar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/gtar: Child returned status 1
/bin/gtar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/gtar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpIT5jNR/R.INSTALL17d113d7c2a/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
It stops after this, floating and then I have to crash R to fix it. I have scoured through the nlopt site and based on the error have attempted to install into R manually. I have the actual tar file and I have placed it into Rstudios package file, then gone through the process of installing it. However, this does not seem to work at all. I am guessing there is something specific to R that needs to be done to complete the install?
Note I have tried installing just the nlopt via install.packages and the same error occurs. Any ideas?
Edit 1:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.9 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets
[7] methods base
other attached packages:
[1] nnet_7.3-11 Hmisc_3.17-0 Formula_1.2-1
[4] survival_2.38-3 lattice_0.20-33 readxl_0.1.0
[7] reshape2_1.4.1 ggplot2_1.0.1 dplyr_0.4.3
[10] data.table_1.9.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 cluster_2.0.3 magrittr_1.5
[4] splines_3.2.2 MASS_7.3-43 munsell_0.4.2
[7] colorspace_1.2-6 R6_2.1.1 stringr_1.0.0
[10] plyr_1.8.3 tools_3.2.2 parallel_3.2.2
[13] gtable_0.1.2 latticeExtra_0.6-26 DBI_0.3.1
[16] lazyeval_0.1.10 assertthat_0.1 digest_0.6.8
[19] gridExtra_2.0.0 RColorBrewer_1.1-2 acepack_1.3-3.3
[22] rpart_4.1-10 stringi_1.0-1 RevoUtils_8.0.0
[25] scales_0.3.0 foreign_0.8-65 chron_2.3-47
[28] proto_0.3-10
I reconogize I am not using the most recent version of R and unfortunitly will not be able to upgrade. However, Caret package information claims it should work on anything greater than R(>=2.1), lattice(>=0.2) and ggplot2. All of which criteria is met.

Images not showing in R notenook (nb.html file)

When I knit to HTML, images show up fine in the .html file, but not the .nb.html one. MWE is the R Notebook template: the plot(cars) image does not show.
Per suggestions listed here: RStudio notebook does not show data.frames when I compile, I tried older/newer/dev versions of rmarkdown. I also tried newer/dev versions of knitr. Nothing helped. I have RStudio version 1.0.136.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5
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
other attached packages:
[1] devtools_1.12.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 withr_1.0.2 digest_0.6.11 rprojroot_1.2 R6_2.2.0
[6] jsonlite_1.2 backports_1.0.5 git2r_0.15.0 magrittr_1.5 evaluate_0.10
[11] highr_0.6 httr_1.2.1 stringi_1.1.2 curl_2.3 rstudioapi_0.6
[16] rmarkdown_1.3 tools_3.3.2 stringr_1.1.0 yaml_2.1.14 rsconnect_0.7
[21] base64enc_0.1-3 memoise_1.0.0 htmltools_0.3.5 knitr_1.15.8
Thanks to RStudio for pointing out that this is expected behavior. I had switched the chunk output setting to Chunk Output in Console so I could view plots in the plot window. I didn't realize that all chunks must be run inline to appear in the notebook. I switched back to Chunk Output Inline, ran the chunks, and all was well.

R Shinyapp works locally but not on Shinyapp.io server

I am trying to make a shinyapp which let users upload a certain format of file. After uploading the file, the shinyapp will automatically plot some table and charts using dplyr and rCharts.
It works well when I run it locally using “Run App”. However, when I publish to shinyapp.io, I got this error:
path1="": No such file or directory
After searching on the internet, I haven’t found any solution to solve this problem. Could anyone help me on what the possible reason causing this issue?
Here is my code and my sessionInfo().(It's a little bit long and messy)
https://github.com/johnnychiuchiu/Cheetah_ShinyApp/blob/master/server.r
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)
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
[7] base
other attached packages:
[1] stringr_1.0.0 dplyr_0.4.2 rCharts_0.4.5 shiny_0.12.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.1 lattice_0.20-33 assertthat_0.1
[4] digest_0.6.8 mime_0.3 grid_3.2.2
[7] plyr_1.8.3 R6_2.1.0 DBI_0.3.1
[10] xtable_1.7-4 jsonlite_0.9.16 magrittr_1.5
[13] stringi_0.5-5 lazyeval_0.1.10 rstudioapi_0.3.1
[16] whisker_0.3-2 RJSONIO_1.3-0 tools_3.2.2
[19] parallel_3.2.2 httpuv_1.3.3 yaml_2.1.13
[22] rsconnect_0.4.1.4 htmltools_0.2.6
The "h" in "Highcharts" needs to be lowercase, e.g.:
showOutput("h5", "highcharts"),
If that doesn't work: For the deployment, showOutput needs you to detail the path to your rcharts-lilbrary (at least in my case, for whatever reason ^^).
I had a problem which was very similar to yours. Here's my solution:
"ERROR: path[1]="": No such file or directory" when publishing Parallel Coordinates Chart with Shiny

Resources