I am currently moving a (localhost) shiny App from a windows 32-bit to windows 64-bit . Google didn't managed to answer my problem :( so I'm asking the community !
This App worked fine on 32 bits, I had to re-install R, all Packages, Java on the 64-bit machine (each in the 64-bit mode). My app has the following file architecture :
a gloabl.R file where I load libraries
a server.R
List item
a ui.R
another file which format data to be sent d3/nvd3
a JS file to display a linechart.
the error I have is the following :
Warning in file(con, "rb") : file("") only supports open = "w+" and
open = "w+b": using the former Warning: Error in readChar: invalid
'nchars' argument Stack trace (innermost first):
1: runApp Error : invalid 'nchars' argument
When I'm running code without shiny, all works fine, all is precessed and results are good.
Does anyone has ever been facing to this ?
If you need anything just ask I will be more specific. I am not giving you the code, he is a little tricky and is in multiple files... And I think it is specific to my new environement.
Reinstalling solely the shiny-package fixed the problem for me. I am using R-studio, and did the operation through the Packages window (deleted and reinstalled).
Related
I have had various R Shiny applications running successfully (some for over a year) on a Windows PC serving a local intranet network.
In the last couple of weeks, the applications started to fail loading plots with the error:
unable to start png() device.
Restarting the application would fix the problem, but only for a few hours when it would error again.
At the time I had not changed anything in R, although since the isuue started I have updated everything hoping it would fix the problem. There was no change after the updates.
When I load an app that is freshly restarted there are no warnings. When there are errors, the console prints the following:
unable to open file 'C:\Users\jgerla03\AppData\Local\Temp\Rtmp4QtNQ2\file91819b61552' for writing
Warning in dev_fun(file = tempfile(), width = width %||% 640, height = height %||% :
opening device failed
Warning: Error in dev_fun: unable to start png() device
107: dev_fun
106: gg2list
105: ggplotly.ggplot
102: plotly_build.gg
98: getFromNamespace("prepareWidget", "plotly")
97: shinyRenderWidget
96: func
83: renderFunc
82: output$fmc_summary_plot
1: shiny::runApp
Warning in normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Users\jgerla03\AppData\Local\Temp\Rtmp4QtNQ2": The system cannot find the file specified
The shiny apps are run from an admin account with highest privileges (run from Windows 10 Task Scheduler or commandline). The appdata temp folder specified in the error message gives all users permission to read/write/everything, but the toggle saying "read only" is on everytime I open the "properties" window for the folder (despite me unclicking it and applying each time).
I am so confused because everything works perfectly for the first few hours after a restart which makes this issue more difficult to test.
This seems similar to Error: unable to start png() device in R Shiny Dashboard , which never received a response. I hope the extra detail I provided will help someone to suggest a solution.
I have seen similar behaviour using a ubuntu shiny server and it was traced back to running out of system resources (disk space in my case) which ment that temporary files could not be created.
Your error message ...
"unable to open file 'C:\Users\jgerla03\AppData\Local\Temp\Rtmp4QtNQ2\file91819b61552'"
looks similar to what I experienced. I'm not familiar with Windows OS but would suggest you look into the possibility that you are running out of disk or memory space..
Peter
I know I'm not the only one with this problem but I have tried several solutions and nothing has worked yet. When I'm deploying my shinyapp (that works perfectly on Windows 11 and 10) i get this warning:
Warning messages:
1: In fileDependencies.R(file) :
Failed to parse C:/Users/nicol/AppData/Local/Temp/RtmpQF8uhX/file438c489067a3/app.R ; dependencies in this file will not be discovered.
I have tried saving my app as a UTF-8 file (there are German Umlauts in it) in RStudio and I have tried to use this as the first line of my code:
options(encoding = "UTF-8")
I deploy on the Rstuido GUI. Maybe that's the problem. But I don't understand how to deploy through the commandline.
Thx for your help
Found a solution. You have to deploy your app through the commandline and use this:
tmp.enc <- options()$encoding
options(encoding = "UTF-8")
rsconnect:: deployApp()
This can be a bit complicated because you can't chose from the GUI what you want to upload to shinymaps.io but at least it works.
I am trying to source a script from my github repo containing functions I use often.
So I have that line at the beginning of my script:
source("https://github.com/jogaudard/common/blob/master/fun-fluxes.R")
In RStudio it returns (same with R in the terminal)
Error in source("https://github.com/jogaudard/common/blob/master/fun-fluxes.R") :
https://github.com/jogaudard/common/blob/master/fun-fluxes.R:6:1: unexpected '<'
5:
6: <
^
In an online R editor I got
Error in file(filename, "r", encoding = encoding) :
cannot open the connection to 'https://github.com/jogaudard/common/blob/master/fun-fluxes.R'
Calls: source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
URL 'https://github.com/jogaudard/common/blob/master/fun-fluxes.R': status was 'Couldn't resolve host name'
Execution halted
I tried with other scripts. I get the same error with anything that is online. source() is working fine with scripts in local (both in the same directory or somewhere else).
It happened since I installed a package that messed a bit with curl. So I thought that might be the issue. But when I tried from another computer I got the same error.
Both computers have R version 3.6.3 on Ubuntu 18.04.5 LTS
I am honestly lost. Cannot find any similar issues anywhere.
You are sourcing a file with html markup and R considers that markup (correctly) to be syntax errors. Use source("https://raw.githubusercontent.com/jogaudard/common/master/fun-fluxes.R") to source the "raw" file.
Your issue with the online R services is a red herring. If you need someone to look into that, you should provide a URL for the service.
I'm trying to publish an R Shiny app. It works when run locally, but once published to shinyapps.io produces the following error.
Warning in gzfile(file, "wb") :
cannot open compressed file '/key.rda', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
You can also see the actual page with the error here: https://povertylab.shinyapps.io/ACS-Map-Dashboard/
Though I have tried to reproduce this error it doesn't appear when I publish other apps, and my searches haven't turned up anything. Other things I've tried: publishing from other computers, publishing only global.R, server.R, and ui.R files, and copying files to a new project and publishing from there.
You can find all code for the app here: https://github.com/Poverty-Lab/ACS-Map-Dashboard
I would appreciate any input, even if it's just guidance on what gzfile is and what the error message could mean. Thank you!
Where is the key.rda file supposed to be? I've looked through your repo and I don't see it, which is probably causing the "cannot open the connection" error.
As a side note, you should probably ignore the .Renviron file; right now anyone can use see and use your key. Make sure you remove it from the history as well.
Thanks all. Turns out this was a problem with the way we were handing the api key for the acs package. We were using api.key.install to install the api key inside the app, and one of api.key.install's default arguments is file = "key.rda", and that file apparently could not be found. I'm still not sure why this problem only came up when we published the app, but we got around it by supplying the actual api key to the acs.fetch function in server.R.
I am a starter in R and new to StackOverflow and this is the first time I raise a question, I hope i'm following all the rules...
Anyway. I got R (3.5.0 version) and R-Studio on my laptop with Win 10 Home installed (under the same parent folder 'D:\') and reset the temporary file directory to a folder in D:\ so that the Chinese in C:\Users\中文\documents (which is the default place for tempo files) doesn't affect the connection btw R-studio and R (I was told any relevant directory has to be in English to make R-Studio work).
The problem is, I cannot install the 'graphics' package when I run
install.packages('graphics')
The resulting error says something like this:
>Error in install.packages : Updating loaded packages
>Restarting R session...
>Error in gzfile(file, "wb") : cannot open the connection
>Error saving session (options): R code execution error
>WARNING: Forcing suspend of process in spite of all session data not being fully saved.
It's quite weird since the 'graphics' package is pretty basic and as a matter of fact I haven't found anyone reporting such errors on the internet.
It also bothers me that other packages like 'forecast' and 'XML' can be successfully installed without any error report.
I've looked at some similar questions on StackOverflow, having error reports with "Error in gzfile(file, "wb") : cannot open the connection", but they all seem to have something else to complete the sentence. In my case it just stops the error description with "cannot open the connection". Also I couldn't find people having similar problems with "Error saving session (options): R code execution error".
I do realize that this is quite unusual. I can't even find the proper tags other than r for this question. Although it seems that no one has trouble with the 'graphics', this problem is really bothering me and I hope someone can give possible solutions. Thanks a lot.