Running a python script via a published R shiny app

1,223 views
Skip to first unread message

Dirk Haupt

unread,
Sep 29, 2015, 12:37:26 AM9/29/15
to ShinyApps Users
Do the R Shiny servers not have python installed? Why is it that my app works when I run it locally but it fails after I publish it it shinyapps.io?

Andy Kipp

unread,
Sep 29, 2015, 9:19:16 AM9/29/15
to Dirk Haupt, ShinyApps Users
Dirk,

Have you checked the output of the command:

rsconnect::showLogs()


-Andy

On Tue, Sep 29, 2015 at 12:37 AM, Dirk Haupt <dirk....@gmail.com> wrote:
Do the R Shiny servers not have python installed? Why is it that my app works when I run it locally but it fails after I publish it it shinyapps.io?

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/6e0525d9-6b30-41d7-adf6-0bfab51fffdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dirk Haupt

unread,
Sep 29, 2015, 4:42:22 PM9/29/15
to Andy Kipp, ShinyApps Users
My apologies. I see now that this is a standard thing to do via the "getting started" page. stack overflow question amended - drastically (got the memo from the downvote). Got rid of bonus info and honed in on what is actually causing the problem now that it has been found.

here's the log clearly showing that rPython package could not be installed. I deduce that this means that I wont be able to get it to work? Is there no workaround? I'd like my app published to shinyapps.io to call a python script. Thanx for confirming.

> rsconnect::showLogs("/home/cornelis/Documents/R Shiny/BrainImageAnalyzer")
2015-09-28T19:32:32.126565+00:00 shinyapps[61711]:     find, fix
2015-09-28T19:32:32.126567+00:00 shinyapps[61711]:
2015-09-28T19:32:32.131509+00:00 shinyapps[61711]:
2015-09-28T19:32:32.131506+00:00 shinyapps[61711]:
2015-09-28T19:32:32.131507+00:00 shinyapps[61711]:     sum
2015-09-28T19:32:34.974927+00:00 shinyapps[61711]: Note: the specification for S3 class “AsIs” in package ‘jsonlite’ seems equivalent to one from package ‘RJSONIO’: not turning on duplicate class definitions for this class.
2015-09-28T19:32:35.010367+00:00 shinyapps[61711]: Installing package into ‘/usr/local/lib/R/site-library’
2015-09-28T19:32:35.010369+00:00 shinyapps[61711]: (as ‘lib’ is unspecified)
2015-09-28T19:32:35.011193+00:00 shinyapps[61711]: Warning in install.packages("rPython") :
2015-09-28T19:32:35.011195+00:00 shinyapps[61711]:   'lib = "/usr/local/lib/R/site-library"' is not writable
2015-09-28T19:32:35.012074+00:00 shinyapps[61711]: Error in install.packages("rPython") : unable to install packages
2015-09-28T21:11:47.712151+00:00 shinyapps[61711]: R version: 3.2.2
2015-09-28T21:11:47.712222+00:00 shinyapps[61711]: shiny version: 0.12.2
2015-09-28T21:11:47.712224+00:00 shinyapps[61711]: rmarkdown version: NA
2015-09-28T21:11:47.712225+00:00 shinyapps[61711]: knitr version: NA
2015-09-28T21:11:47.712236+00:00 shinyapps[61711]: jsonlite version: 0.9.17
2015-09-28T21:11:47.712238+00:00 shinyapps[61711]: RJSONIO version: 1.3.0
2015-09-28T21:11:47.712239+00:00 shinyapps[61711]: htmltools version: 0.2.6
2015-09-28T21:11:47.964077+00:00 shinyapps[61711]: Using jsonlite for JSON processing
2015-09-28T21:11:47.968227+00:00 shinyapps[61711]:
2015-09-28T21:11:47.968229+00:00 shinyapps[61711]: Starting R with process ID: '11'
2015-09-28T21:11:47.973370+00:00 shinyapps[61711]:
2015-09-28T21:11:47.973374+00:00 shinyapps[61711]: Listening on http://0.0.0.0:34230
2015-09-28T21:11:50.566927+00:00 shinyapps[61711]:
2015-09-28T21:11:50.566944+00:00 shinyapps[61711]: Attaching package: ‘rsconnect’
2015-09-28T21:11:50.566945+00:00 shinyapps[61711]:
2015-09-28T21:11:50.567521+00:00 shinyapps[61711]: The following objects are masked from ‘package:shiny’:
2015-09-28T21:11:50.567523+00:00 shinyapps[61711]:
2015-09-28T21:11:50.567524+00:00 shinyapps[61711]:     hr, serverInfo
2015-09-28T21:11:50.781970+00:00 shinyapps[61711]: Attaching package: ‘matlab’
2015-09-28T21:11:50.567525+00:00 shinyapps[61711]:
2015-09-28T21:11:50.781965+00:00 shinyapps[61711]:
2015-09-28T21:11:50.782183+00:00 shinyapps[61711]:
2015-09-28T21:11:50.781971+00:00 shinyapps[61711]:
2015-09-28T21:11:50.782181+00:00 shinyapps[61711]: The following object is masked from ‘package:stats’:
2015-09-28T21:11:50.783160+00:00 shinyapps[61711]: The following objects are masked from ‘package:utils’:
2015-09-28T21:11:50.782184+00:00 shinyapps[61711]:     reshape
2015-09-28T21:11:50.782185+00:00 shinyapps[61711]:
2015-09-28T21:11:50.783163+00:00 shinyapps[61711]:     find, fix
2015-09-28T21:11:50.783162+00:00 shinyapps[61711]:
2015-09-28T21:11:50.788106+00:00 shinyapps[61711]:     sum
2015-09-28T21:11:50.788104+00:00 shinyapps[61711]: The following object is masked from ‘package:base’:
2015-09-28T21:11:50.783164+00:00 shinyapps[61711]:
2015-09-28T21:11:50.788108+00:00 shinyapps[61711]:
2015-09-28T21:11:50.788105+00:00 shinyapps[61711]:
2015-09-28T21:11:52.811318+00:00 shinyapps[61711]: Note: the specification for S3 class “AsIs” in package ‘jsonlite’ seems equivalent to one from package ‘RJSONIO’: not turning on duplicate class definitions for this class.
2015-09-28T21:11:52.905303+00:00 shinyapps[61711]: Installing package into ‘/usr/local/lib/R/site-library’
2015-09-28T21:11:52.905306+00:00 shinyapps[61711]: (as ‘lib’ is unspecified)
2015-09-28T21:11:52.905907+00:00 shinyapps[61711]: Warning in install.packages("rPython") :
2015-09-28T21:11:52.905909+00:00 shinyapps[61711]:   'lib = "/usr/local/lib/R/site-library"' is not writable
2015-09-28T21:11:52.906488+00:00 shinyapps[61711]: Error in install.packages("rPython") : unable to install packages

Andy Kipp

unread,
Sep 29, 2015, 4:55:51 PM9/29/15
to Dirk Haupt, ShinyApps Users
So you are attempting to install the rPython package inside your code via install.packages? Typically this is not needed, and is actually not allowed.

Its usually sufficient to include have a library(Rpython) call inside your server.R which will be detected and the dependency automatically installed when you publish your shinyapps. However, while most packages work correctly, some do not. I have not tested Rpython specifically, so you might try removing the install.packages line (which definitely wont work), and letting the automatic dependency resolver do its things, and see how far you get.

Dirk Haupt

unread,
Sep 29, 2015, 5:14:21 PM9/29/15
to Andy Kipp, ShinyApps Users
No, I only have library (Rpython) in my code. That part of the log was a stab in the dark on my part. Whether I have the install.packages line or not the published app still fails to work.

I don't suppose there's any way of getting python installed/working on the shinyapps.io servers? The comments on stack overflow all seem to point to this being the issue. I find it odd though because RStudio itself has python support: http://www.r-bloggers.com/controlling-rstudio-python-child-processes/

sabameh...@gmail.com

unread,
Jul 31, 2017, 7:38:24 AM7/31/17
to shinyapps.io Users
how can i test my app 

sabameh...@gmail.com

unread,
Jul 31, 2017, 7:42:07 AM7/31/17
to shinyapps.io Users
in order to test my app it gives the error after writing this code.
library(shiny)
runApp()
plz tell me how can i set my working directory


On Tuesday, September 29, 2015 at 9:37:26 AM UTC+5, Dirk Haupt wrote:
Reply all
Reply to author
Forward
0 new messages