vituri
November 24, 2021, 5:30pm
1
I've created a small package which you can install with devtools::install_github('vituri/testencoding')
. It has just two functions:
#' @export
hello_fixed <- function() {
x = iris
x$`Pétala` = 'Á'
x$`Mácula` = 'Ê'
x$`Pãõáéíóúçàâêô` = 'Ç'
x
}
#' @export
hello <- function() {
x = iris
x$Pétala = 'Á'
# x$Mácula = 'Ê'
# x$Pãõáéíóúçàâêô = 'Ç'
x
}
I've never had problems uploading packages where I deal with columns with accents, like in x$Pétala... until three days ago. I can't deploy any app which uses my packages now. If I put the column name around backticks as in hello_fixed, it works (but I would have to put backticks in all variables in all my packages, which I never needed until now.)
The following app runs fine locally:
library(shiny)
library(testencoding)
ui <- fluidPage(
tableOutput('tabela')
)
server <- function(input, output, session) {
output$tabela = renderTable({
hello()
})
}
shinyApp(ui, server)
but when I try to upload it to shinyapps, I get the following error:
[2021-11-24T17:26:26.292571220+0000] Building R package: testencoding (0.1.0)
/mnt/packages/build /mnt
Warning: unknown option '--vanilla'
Warning in untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
* installing to library '/opt/R/4.1.2/lib/R/library'
* installing *source* package 'testencoding' ...
** using staged installation
** R
Error in parse(outFile) :
invalid multibyte character in parser at line 14
ERROR: unable to collate and parse R files for package 'testencoding'
* removing '/opt/R/4.1.2/lib/R/library/testencoding'
################################# End Task Log #################################
Erro: Unhandled Exception: Child Task 1055795119 failed: Error building image: Build exited with non-zero status: 1
Execução interrompida
The exactly same app would work normally last week.
Anyone has a solution?
vituri
November 24, 2021, 6:05pm
2
Here's another error, with other package (which previosly worked):
* installing *source* package 'analytics' ...
** using staged installation
** R
Error in parse(outFile) :
/tmp/RtmpVzFT4h/R.INSTALLe4be02ac0/vituri-analytics-bcb92e0f4c307ab9a9e759103760b9dd42ff268e/R/dados.R:13:19: unexpected input
12: filter(Dia %in% dias &
13: Opera�
^
ERROR: unable to collate and parse R files for package 'analytics'
* removing '/opt/R/4.1.2/lib/R/library/analytics'
GET /v1/tasks/?filter=account_id:547566&filter=parent_id:1055815781&count=100&offset=0 617ms
################################# End Task Log #################################
Erro: Unhandled Exception: Child Task 1055815781 failed: Error building image: Build exited with non-zero status: 1
----- Deployment error -----
Erro: Unhandled Exception: Child Task 1055815781 failed: Error building image: Build exited with non-zero status: 1
----- Error stack trace -----
4: rsconnect::deployApp(appDir = pasta_app, appName = "xxxxxxxxxxx",
upload = TRUE, logLevel = "verbose", lint = TRUE, forceUpdate = TRUE)
3: client$waitForTask(taskId, quiet)
2: stop(status$error, call. = FALSE)
1: (function (e)
{
cat("----- Deployment error -----\n")
The problematic character is a ç
.
Can you post the results of
sessionInfo()
ere?
It almost sounds like your encoding has somehow reset itself from *UTF-8 * to something else.
vituri
November 25, 2021, 1:19pm
4
Here it is:
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8 LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8
[7] LC_PAPER=pt_BR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] testencoding_0.1.0 shiny_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 digest_0.6.28 later_1.3.0 mime_0.12 R6_2.5.1 lifecycle_1.0.1 xtable_1.8-4
[8] magrittr_2.0.1 rlang_0.4.12 promises_1.2.0.1 ellipsis_0.3.2 tools_4.1.2 httpuv_1.6.3 fastmap_1.1.0
[15] compiler_4.1.2 htmltools_0.5.2.9000
vituri
November 25, 2021, 1:36pm
5
Update: I tried to deploy the same app above in two other machines (one with Ubuntu, another with Windows) and got the same error. I believe this is something on the shinyapps.io part.
Certainly my idea was wrong. I am not a shiny user so I am of no help. Good luck.
1 Like
vituri:
pt_BR.UTF-8
This locale is not available on shinyapps.io servers so it defaults back to English, try just setting the encoding before calling deployApp()
options(encoding = "UTF-8")
vituri
November 25, 2021, 4:16pm
8
Hi, @andresrcs !
I always used this encoding option without problems. Here is the output now:
> library(dplyr)
> options(encoding = "UTF-8")
> pasta_app = "Teste vituripackage/" %>% normalizePath()
> rsconnect::deployApp(appDir = pasta_app,
+ appName = "teste1234",
+ upload = TRUE, logLevel = "verbose", lint = TRUE, forceUpdate = TRUE)
----- Deployment log started at 2021-11-25 13:12:49 -----
Deploy command:
rsconnect::deployApp(appDir = pasta_app, appName = "teste1234", upload = TRUE, logLevel = "verbose", lint = TRUE, forceUpdate = TRUE)
Session information:
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=pt_BR.UTF-8 LC_NUMERIC=C LC_TIME=pt_BR.UTF-8 LC_COLLATE=pt_BR.UTF-8 LC_MONETARY=pt_BR.UTF-8 LC_MESSAGES=pt_BR.UTF-8 LC_PAPER=pt_BR.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.0.7
loaded via a namespace (and not attached):
[1] magrittr_2.0.1 usethis_2.1.3 devtools_2.4.2 tidyselect_1.1.1 pkgload_1.2.3 R6_2.5.1 rlang_0.4.12 fastmap_1.1.0 fansi_0.5.0 tools_4.1.2 pkgbuild_1.2.0
[12] sessioninfo_1.2.1 utf8_1.2.2 DBI_1.1.1 cli_3.1.0 withr_2.4.2 ellipsis_0.3.2 remotes_2.4.1 assertthat_0.2.1 rprojroot_2.0.2 tibble_3.1.6 lifecycle_1.0.1
[23] crayon_1.4.2 processx_3.5.2 purrr_0.3.4 callr_3.7.0 vctrs_0.3.8 fs_1.5.0 ps_1.6.0 rsconnect_0.8.26 testthat_3.1.0 memoise_2.0.0 glue_1.5.0
[34] cachem_1.0.6 pillar_1.6.4 compiler_4.1.2 generics_0.1.1 desc_1.4.0 prettyunits_1.1.1 pkgconfig_2.0.3
Cookies:
[1] "None"
GET /v1/applications/?filter=account_id:547566&filter=name:teste1234&count=100&offset=0 896ms
POST /v1/applications/ 694ms
----- Bundle upload started at 2021-11-25 13:12:51 -----
[2021-11-25 13:12:51] Inferring App mode and parameters
[2021-11-25 13:12:51] Bundling app dir
[2021-11-25 13:12:51] Generate manifest.json
[2021-11-25 13:12:51] Starting to perform packrat snapshot
Adding these packages to packrat:
_
R6 2.5.1
Rcpp 1.0.7
base64enc 0.1-3
bslib 0.3.1
cachem 1.0.6
commonmark 1.7
crayon 1.4.2
digest 0.6.28
ellipsis 0.3.2
fastmap 1.1.0
fontawesome 0.2.2
fs 1.5.0
glue 1.5.0
htmltools 0.5.2.9000
httpuv 1.6.3
jquerylib 0.1.4
jsonlite 1.7.2
later 1.3.0
lifecycle 1.0.1
magrittr 2.0.1
mime 0.12
promises 1.2.0.1
rappdirs 0.3.3
rlang 0.4.12
sass 0.4.0
shiny 1.7.1
sourcetools 0.1.7
testencoding 0.1.0
withr 2.4.2
xtable 1.8-4
[2021-11-25 13:12:52] Completed performing packrat snapshot
[2021-11-25 13:12:52] Writing Rmd index if necessary
[2021-11-25 13:12:52] Compressing the bundle
POST /v1/bundles 688ms
[2021-11-25 13:12:53] Starting upload now
PUT /bundles/application-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[2021-11-25 13:12:54] Upload complete
POST /v1/bundles/5293231/status 663ms
GET /v1/bundles/5293231 650ms
[2021-11-25 13:12:55] Saving deployment record for teste1234 -
----- Server deployment started at 2021-11-25 13:12:55 -----
POST /v1/applications/5204980/deploy 788ms
Waiting for task: 1056356678
GET /v1/tasks/1056356678 645ms
building: Processing bundle: 5293231
GET /v1/tasks/1056356678 680ms
building: Building image: 6131326
GET /v1/tasks/1056356678 646ms
building: Building package: testencoding
GET /v1/tasks/1056356678 652ms
################################ Begin Task Log ################################
GET /v1/tasks/1056356678/logs/ 638ms
GET /v1/tasks/?filter=account_id:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GET /v1/tasks/1056356681/logs/ 655ms
[2021-11-25T16:13:00.818454077+0000] Installing R package: xtable (1.8-4)
* installing to library '/opt/R/4.1.2/lib/R/library'
* installing *binary* package 'xtable' ...
* DONE (xtable)
[2021-11-25T16:13:01.030771276+0000] Installing R package: withr (2.4.2)
* installing to library '/opt/R/4.1.2/lib/R/library'
* installing *binary* package 'withr' ...
* DONE (withr)
[2021-11-25T16:13:01.221946251+0000] Building R package: testencoding (0.1.0)
/mnt/packages/build /mnt
Warning: unknown option '--vanilla'
Warning in untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
* installing to library '/opt/R/4.1.2/lib/R/library'
* installing *source* package 'testencoding' ...
** using staged installation
** R
Error in parse(outFile) :
invalid multibyte character in parser at line 14
ERROR: unable to collate and parse R files for package 'testencoding'
* removing '/opt/R/4.1.2/lib/R/library/testencoding'
GET /v1/tasks/?filter=account_id:547566&filter=parent_id:1056356681&count=100&offset=0 652ms
################################# End Task Log #################################
Erro: Unhandled Exception: Child Task 1056356681 failed: Error building image: Build exited with non-zero status: 1
----- Deployment error -----
Erro: Unhandled Exception: Child Task 1056356681 failed: Error building image: Build exited with non-zero status: 1
----- Error stack trace -----
4: rsconnect::deployApp(appDir = pasta_app, appName = "teste1234",
upload = TRUE, logLevel = "verbose", lint = TRUE, forceUpdate = TRUE)
3: client$waitForTask(taskId, quiet)
2: stop(status$error, call. = FALSE)
1: (function (e)
{
cat("----- Deployment error -----\n")
...
Can you install this package testencoding from github? In my machine it runs fine.