Hello,
the first example of shiny is not working if I install R and shiny with conda in ubuntu 18.04. I do this:
conda create -n r_env
conda activate r_env
conda install -c r r
conda install -c r r-shiny (or install.packages("shiny"))
Then I open rstudio and run this
shiny::runExample("01_hello")
and I can see the sliderInput but not the histogram. I open the webpage created by shiny and then the developer tools from Chrome and it says:
Uncaught SyntaxError: Unexpected number in JSON at position 16062
at JSON.parse ()
at ShinyApp.dispatchMessage (shinyapp.js:495)
at WebSocket.c.onmessage (shinyapp.js:112)
However if I install R in the system and shiny with install.packages (no conda involved) everything works perfectly.
Best
As far as I know, Shiny is not officially supported through conda so I think it would be better to point this out on a conda related forum.
Etjean
April 16, 2020, 12:44pm
3
Hello,
I am currently facing the exact same problem, and this is the only post I could find about it. Have you found any solution ? Or even narrowed down the search ?
Thanks in advance
Hello Etjean,
I didn't try the purposed solution, sorry.
I'm currently facing the same problem. I'd be thankful for any solutions or referrals to other communities that might be able to help.
Thanks!
We've found the cause of the problem. It appears to be an incorrect locale setting used by conda.
According to the documentation for Sys.setlocale
, LC_NUMERIC
should always be set to "C"
, but with conda, it may be set to a different value.
To fix it, you can run this in your R session:
Sys.setlocale("LC_NUMERIC", "C")
Please see here for more information:
opened 07:53AM - 16 Apr 20 UTC
closed 07:30AM - 20 Apr 20 UTC
<!--
This issue tracker is for bugs and feature requests in the Shiny package. … If you're having trouble with Shiny Server or a related package, please file an issue in the appropriate repository.
If you're having trouble with shinyapps.io, and you have a paid account (Starter, Basic, Standard, or Pro), please file a support ticket via https://support.rstudio.com. If you have a Free account, please post to the RStudio Community with the shinyappsio tag: https://community.rstudio.com/tags/shinyappsio.
Finally, if you are an RStudio customer and are having trouble with one of our Pro products, get in touch with our support team at support@rstudio.com.
Before you file an issue, please upgrade to the latest version of Shiny from CRAN and confirm that the problem persists.
# First, restart R.
# To install latest shiny from CRAN:
install.packages("shiny")
See our guide to writing good bug reports for further guidance: https://github.com/rstudio/shiny/wiki/Writing-Good-Bug-Reports. The better your report is, the likelier we are to be able to reproduce and ultimately solve it.
-->
### System details
Browser Version: Firefox 75.0 & Chrome 80.0.3987.162
Output of `sessionInfo()`:
```
R version 3.6.1 (2019-07-05)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
Matrix products: default
BLAS/LAPACK: /home/etienne/miniconda3/envs/R/lib/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=fr_FR.UTF-8
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=fr_FR.UTF-8
[9] LC_ADDRESS=fr_FR.UTF-8 LC_TELEPHONE=fr_FR.UTF-8
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=fr_FR.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] shiny_1.4.0.2 forcats_0.5.0 stringr_1.4.0 dplyr_0.8.5
[5] purrr_0.3.3 readr_1.3.1 tidyr_1.0.2 tibble_3.0.0
[9] ggplot2_3.2.1 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] tidyselect_1.0.0 haven_2.2.0 lattice_0.20-40 colorspace_1.4-1
[5] vctrs_0.2.4 generics_0.0.2 htmltools_0.4.0 rlang_0.4.5
[9] pillar_1.4.3 later_1.0.0 glue_1.4.0 withr_2.1.2
[13] DBI_1.1.0 dbplyr_1.4.2 modelr_0.1.6 readxl_1.3.1
[17] lifecycle_0.2.0 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0
[21] rvest_0.3.5 fastmap_1.0.1 httpuv_1.5.2 fansi_0.4.1
[25] broom_0.5.5 Rcpp_1.0.4 xtable_1.8-4 scales_1.1.0
[29] backports_1.1.5 promises_1.1.0 jsonlite_1.6.1 mime_0.9
[33] fs_1.3.2 hms_0.5.3 digest_0.6.25 stringi_1.4.3
[37] grid_3.6.1 cli_2.0.2 tools_3.6.1 magrittr_1.5
[41] lazyeval_0.2.2 crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.0
[45] xml2_1.2.2 reprex_0.3.0 lubridate_1.7.4 assertthat_0.2.1
[49] httr_1.4.1 rstudioapi_0.11 R6_2.4.1 nlme_3.1-145
[53] compiler_3.6.1
```
### Example application *or* steps to reproduce the problem
Example 1 :
```R
runExample("01_hello")
```
Example 2 :
```R
runExample("04_mpg")
```
Example 3 : (from the [shiny reference](https://shiny.rstudio.com/reference/shiny/1.4.0/plotOutput.html) )
```R
# A basic shiny app with a plotOutput
shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("newplot", "New plot")
),
mainPanel(
plotOutput("plot")
)
)
),
server = function(input, output) {
output$plot <- renderPlot({
input$newplot
# Add a little noise to the cars data
cars2 <- cars + rnorm(nrow(cars))
plot(cars2)
})
}
)
```
### Describe the problem in detail
Hello,
My problem : I cannot get any plot showing. No error is displayed, all other widgets and outputs are correctly rendered, but not plots.
I have tried the following :
- base plots and ggplots
- firefox and chrome
- shiny 1.4.0 and shiny 1.3.2
- R versions 3.6.1, 3.5.1 and 3.4.3
but the results remain the same.
The problem is related to [this one](https://community.rstudio.com/t/shiny-not-working-installed-with-conda/56448). (I am also using a version of R installed with conda, but I do not understand why that makes shiny plots fail to display).
And in my case, the Firefox developper console shows :
> SyntaxError: JSON.parse: expected double-quoted property name at line 1 column 10523 of the JSON data.
> dispatchMessage shinyapp.js:421
> onmessage shinyapp.js:83
I have searched for similar issues, but I did not find any working solution. Any idea is welcome.
Thanks in advance.
system
Closed
July 14, 2020, 9:29pm
7
This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.