Unable to load data stored with pins on rstudio connect #622 - r

I'm currently working with the package pins. I am an RSW user with the following configuration:
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached are base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pins_1.0.1 yaml_2.3.5
loaded via a namespace (and not attached):
[1] fansi_1.0.3 digest_0.6.29 utf8_1.2.2 crayon_1.5.1 rappdirs_0.3.3 R6_2.5.1
[7] jsonlite_1.8.0 lifecycle_1.0.1 magrittr_2.0.3 httr_1.4.3 pillar_1.7.0 rlang_1.0.2
[13] cli_3.3.0 curl_4.3.2 rstudioapi_0.13 fs_1.5.2 vctrs_0.4.1 ellipsis_0.3.2
[19] tools_4.1.3 glue_1.6.2 rsconnect_0.8.26 compiler_4.1.3 askpass_1.1 pkgconfig_2.0.3
[25] openssl_2.0.2 tibble_3.1.7
I managed to push datasets on R Studio connect with pins.
Now I'd like to use one of that datasets on RSW. I am able to connect on RsStudio connect with the command:
board_rsconnect()
However, when I tried to load one of the datasets by using:
pin_read(board, "earth2")
It doesn't load the data. Instead, there is the following message:
Error in yaml.load(string, error.label = error.label, ...) :
(~/.cache/pins/rsc-e62371cfd77db754024f9c5ed3556a73/51ca356e-619e-4148-b12f-35e3e652d14d/79/data.txt) Scanner error: mapping values are not allowed in this context at line 36, column 20955
In addition: Warning message:
In readLines(file, warn = readLines.warn) :
incomplete final line found on '~/.cache/pins/rsc-e62371cfd77db754024f9c5ed3556a73/51ca356e-619e-4148-b12f-35e3e652d14d/79/data.txt'
By searching similar issues, someone has achieved to load it by deleting the data.txt file but it failed for me. https://github.com/rstudio/pins/issues/463
Do you know where the error came from?

Related

spark_write fails using sparklyr when connecting to standalone cluster as user that did not start the cluster

I have deployed a standalone spark cluster using Spark 3.3.0. The cluster consists of 4 workers and one master, all having access to shared storage via NFS.
The cluster is started by user ubuntu on all 5 nodes and runs fine.
The issue I have is that, when connecting to the cluster from sparklyr, all calls to spark_write_csv, spark_write_parquet, ... fail.
The reason is, that the target folder is created using the R user, which means the spark cluster cant write to the folder, resulting in permission issues.
The user I log into RStudio Server is test, the cluster runs under the user ubuntu. I can connect to the cluster and work with spark, but writing data to disk fails, as shown below.
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8
[8] LC_NAME=C LC_ADDRESS=C 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] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 sparklyr_1.7.7
loaded via a namespace (and not attached):
[1] tidyselect_1.1.2 forge_0.2.0 haven_2.5.0 gargle_1.2.0 colorspace_2.0-3 vctrs_0.4.1 generics_0.1.3 htmltools_0.5.3
[9] yaml_2.3.5 base64enc_0.1-3 blob_1.2.3 utf8_1.2.2 rlang_1.0.4 pillar_1.8.0 glue_1.6.2 withr_2.5.0
[17] DBI_1.1.3 dbplyr_2.2.1 modelr_0.1.8 readxl_1.4.0 lifecycle_1.0.1 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0
[25] rvest_1.0.2 htmlwidgets_1.5.4 tzdb_0.3.0 fastmap_1.1.0 parallel_4.1.2 fansi_1.0.3 broom_1.0.0 r2d3_0.2.6
[33] openssl_2.0.2 scales_1.2.0 backports_1.4.1 googlesheets4_1.0.0 jsonlite_1.8.0 config_0.3.1 fs_1.5.2 askpass_1.1
[41] hms_1.1.1 digest_0.6.29 stringi_1.7.8 grid_4.1.2 rprojroot_2.0.3 cli_3.3.0 tools_4.1.2 magrittr_2.0.3
[49] crayon_1.5.1 pkgconfig_2.0.3 ellipsis_0.3.2 xml2_1.3.3 reprex_2.0.1 googledrive_2.0.0 lubridate_1.8.0 assertthat_0.2.1
[57] httr_1.4.3 rstudioapi_0.13 R6_2.5.1 compiler_4.1.2
...
sc <- spark_connect(master = "spark://172.16.44.70:7077",
config = config,
app_name = "test")
...
spark_write_csv(sdf_data %>% head(100), path = "/mnt/storage/test-data/")
...
Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage
38.0 failed 4 times, most recent failure: Lost task 0.3 in stage 38.0 (TID 2255)
(172.16.44.80 executor 309): java.io.IOException: Mkdirs failed to create file:/mnt/storage
/test-data/_temporary/0/_temporary/attempt_202208121311203632496408213281273_0038_m_000000_2255
(exists=false, cwd=file:/home/ubuntu/spark-3.3.0-bin-hadoop3/work/app-0220812114226-0003/309)
The issue is that the /mnt/storage/test-data folder is created using the test user.
test#compute1:/mnt/storage$ ls -l
total 124
drwxr-xr-x 3 test test 4096 Aug 12 13:10 test-data
I already tried configuring ACLs to inherit the proper settings, but spark seems to ignore those settings, or at least overwrite them.
Is there a clean way to achieve the right file permissions so that multiple users (specifically, users that are not the cluster user) can write data to disk without migrating to something like yarn, k8s or mesos?

cannot install custom library in R

I am trying to install a custom package that I worked on for a while after moving them to a new system. I am getting the following error.
Error: package or namespace load failed for ‘propSignals’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/boniface/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-propSignals/00new/propSignals/libs/propSignals.so':
/home/boniface/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-propSignals/00new/propSignals/libs/propSignals.so: undefined symbol: _Z15do_linear_decayN4Rcpp6VectorILi14ENS_15PreserveStorageEEEii
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/boniface/R/x86_64-pc-linux-gnu-library/3.6/propSignals’
I tried the following approaches and they didnt work:
R: Error in dyn.load(file, DLLpath = DLLpath, ...)
libgsl.so.25: cannot open shared object file: No such file or directory
More information:
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 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=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8 LC_MONETARY=en_CA.UTF-8
[6] LC_MESSAGES=en_CA.UTF-8 LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.4.2 usethis_2.0.1
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 magrittr_2.0.1 pkgload_1.2.2 R6_2.5.1 rlang_0.4.11 fastmap_1.1.0 fansi_0.5.0
[8] tools_3.6.3 pkgbuild_1.2.0 sessioninfo_1.1.1 utf8_1.2.2 cli_3.0.1 withr_2.4.2 ellipsis_0.3.2
[15] remotes_2.4.1 rprojroot_2.0.2 tibble_3.1.5 lifecycle_1.0.1 crayon_1.4.1 processx_3.5.2 purrr_0.3.4
[22] callr_3.7.0 vctrs_0.3.8 fs_1.5.0 ps_1.6.0 testthat_3.0.4 memoise_2.0.0 glue_1.4.2
[29] cachem_1.0.6 pillar_1.6.3 compiler_3.6.3 desc_1.4.0 prettyunits_1.1.1 pkgconfig_2.0.3
What should I do? I spent so much time trying to fix this and it didnt go anywhere. I would really appreciate if someone can help me with this.

devtools::install_github Error: Failed to install 'unknown package' from GitHub

I got error from installing R packages using devtools::install_github
> devtools::install_github('cole-trapnell-lab/leidenbase')
Error: Failed to install 'unknown package' from GitHub:
SSL certificate problem: self signed certificate in certificate chain
I tried a solution posted here
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
But still got the same error. Any suggestions?
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)
Matrix products: default
BLAS/LAPACK: /mounts/anaconda3/envs/r-4.0.3/lib/libopenblasp-r0.3.12.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.4.2 knitr_1.30 nvimcom_0.9-105
loaded via a namespace (and not attached):
[1] magrittr_2.0.1 usethis_2.0.0 devtools_2.3.2 pkgload_1.1.0 R6_2.5.0
[6] rlang_0.4.10 fansi_0.4.1 tools_4.0.3 pkgbuild_1.2.0 xfun_0.19
[11] sessioninfo_1.1.1 cli_2.2.0 withr_2.3.0 ellipsis_0.3.1 remotes_2.2.0
[16] assertthat_0.2.1 digest_0.6.27 rprojroot_2.0.2 lifecycle_0.2.0 crayon_1.3.4
[21] processx_3.4.5 purrr_0.3.4 callr_3.5.1 fs_1.5.0 ps_1.5.0
[26] curl_4.3 testthat_3.0.1 memoise_1.1.0 glue_1.4.2 compiler_4.0.3
[31] desc_1.2.0 prettyunits_1.1.1
I don't get the ssl error when I run your code, but you could try installing the leidenbase package using remotes::install_github():
#install.packages("remotes")
library(remotes)
install_github('cole-trapnell-lab/leidenbase')
Also it might be worth loading openssl through anaconda, e.g. conda install openssl (might help).

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?

R markdown with RGL gives "You must enable Javascript to view this page properly" error

I have a downloadHandler() in Shiny that generates an html document using R markdown. This document generates rgl plots, which are added to the document using hook_webgl. The application is running on a Shiny server. Everything works fine the first time the download button is used, but on the following occasions I get the error "You must enable Javascript to view this page properly". I am using rglwidgets, but I get the same issues using shinyRGL.
> 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_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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.13.2 rmarkdown_0.9.5 knitr_1.12.3 rglwidget_0.1.1434
[5] rgl_0.95.1441
loaded via a namespace (and not attached):
[1] htmlwidgets_0.6 magrittr_1.5 R6_2.1.2 tools_3.2.4
[5] htmltools_0.3.5 Rcpp_0.12.4 jsonlite_0.9.19 digest_0.6.9
[9] xtable_1.8-2 httpuv_1.3.3 mime_0.4

Resources