Pointing Shiny Server at MRO R on an Azure data science installation

Hi all,

I'm a complete beginner on Linux, and am trying to get a working instance of Shiny Server up on an Azure Ubuntu 16.04 Data Science instance.

Steps so far:

We have MRO installed by default, and it appears to be in THIS location: /opt/microsoft/ropen/3.4.3/lib64/R

Following the instructions here: https://www.rstudio.com/products/shiny/download-server/ I have

  1. NOT installed r-base because I was conscious that they might not play nicely together

sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\"" sudo apt-get install gdebi-core
wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.9.923-amd64.deb sudo gdebi shiny-server-1.5.9.923-amd64.deb

I have then installed rmarkdown:

$ sudo su - -c "R -e "install.packages('rmarkdown', repos='http://cran.rstudio.com/')""

I have then edited the configuration file to a different port, and opened this port on the VM firewall.

I can connect a browser to the Shiny IP:Port, and I get the "It's Alive" Welcome screen. The sliders and drop downs work in the example, however I get not chart or documents appearing in these windows. I believe that Shiny Server cannot 'see' the Microsoft version of R, but I just cannot work out how or where to edit a configuration file to point at the MRO folder. I have tried to read through the instruction manual, but there appears to be no reference on how SPECIFICALLY to change the file location of R. At least, none that I can understand with my current Linux proficiency.

Could anyone please post step by step instructions on how to repoint Shiny to MRO ? I'm working with administrator access. In case it is of relevance, I have an R Server instance running on a separate port - but this was preconfigured in the instance.

Many thanks in advance

Hi! Can you explain a bit more about what you're seeing on the welcome screen? I'm confused by:

The sliders and drop downs work in the example, however I get not chart or documents appearing in these windows.

I'm using Shiny Server Pro, but here's what I see when an instance is working.

If yours looks like that, then I think you're all set on the "configuring R" front. In order for those sliders and dropdowns to work, Shiny Server must have been able to find your R installation already.

If yours didn't look like that, you could check out Shiny Server v1.5.21 Configuration Reference to see how to configure R.

Thanks for replying; we're on Shiny Open source right now until we can build a use case for Pro!

So, in the diagram you've posted, I can see "It's Alive!", I can see the slider "Number of bins" and the slider can be moved back and forth, but I get no histogram. It's an empty frame (with a broken link icon on Explorer). In the Shiny Doc window, I can see the Region drop down box, I can pick another region (e.g. Europe), but the histogram does not appear, it's an empty frame.

I saw the rPath instructions, but they appear to be for PRO only. I have tried to add the MRO location to the path string already, but this hasn't rectified the problem. I've either misspecified it, or I'm not putting it in the right place. I'm on Ubuntu 16.04, and being new to Linux, I do not know whether I should be adding to the references to init, init.d, or using set environment etc.

Thanks for any help you can offer.

  • edit - extra data
    From a clean putty connection, if I type $ which R , it points to /usr/bin/R
    If I then type cd /usr/bin , then R, then MRO R opens on the terminal.

Lets say my login admin account is "datascience" - I've tried changing the run_as name to that (no effect) and back to run_as shiny. The .conf file isn't saved where the instructions indicate it would be, instead it is saved at /etc/shiny-server/shiny-server.conf

I have R Server up and running on a separate port; it points to data/home/datascience (if that is useful at all). All seems to work with that.

If you can see all that, then shiny is already recognizing your R installation and you have a different issue, Do you have set proper permissions for shiny server?

sudo groupadd shiny-apps
sudo usermod -aG shiny-apps your_user_name
sudo usermod -aG shiny-apps shiny
cd /srv/shiny-server
sudo chown -R your_user_name:shiny-apps .
sudo chmod g+w .
sudo chmod g+s .

A screenshot would be really helpful so we can see what you're seeing. It sounds like it found R but maybe there's something wrong with the R installation or its ability to produce images?

Thanks for this suggestion. I have run each command one after the other exactly as above but it appears not to have changed anything on the application html page. I've stopped and started the shiny instance a couple of times, and rebooted the Linux VM too :confused:

I have had a quick look in the log file. After the restart I can see the Node.js reference, it accessing the config file shiny-server.conf, it then warns me that running as root is a security risk, and then says the listerener is starting on http://[::]:8xxx (obscured) -- nothing there that looks obviously to be at fault. My config file has " run_as shiny;" - is that okay in this context?

Linked screen shot below. Thanks.

Perfect, thanks for the screenshot. So R is being called and run in order to generate the interface that you're seeing. So the issue here isn't in finding R; that's already working properly.

The issue is in your instance of R being able to produce images. I usually see this kind of behavior if R was compiled without libpng or libjpeg installed on the system. Unfortunately, I don't know enough about MRO to speak to whether or not they do that correctly or how to fix it if not.

You could look at running capabilities() or manually running the png() function to try to generate a .png image from R t osee if those work for you interactively?

Hi,

So, capabilities() gives me jpeg=T, png=T, tiff=T . Everything is True actually with the exception of aqua. I can render a standard plot to the screen viewer in RStudio with plot() - though I cannot say 100% that this is the same MRO instance; I assume it is. I can call png(etc) - plot() - dev.off() and it generates an image.

However (!); I have opened the dummy application from within RStudio, locally, and when I use Run App from the shiny it locally I get the same empty frame. So it does appear to be from within R (RStudio) on this instance of MRO. Now what!?

Just found this link:

StackOverflow_Link

Looks like this has been a problem for about a year? I have this exact same issue.

Hm, I just tried downloading MRO on a Ubuntu 16.04 instance myself to see how things work. For me , the images actually worked fine, though I ran into other issues with the Shinified-RMarkdown example (the one on bottom), but the histogram on top came up just fine.

I deleted MRO and installed base R and they both worked just fine.

I'm not sure if MRO is a corporate requirement for you or anything, but it might be worth giving base R a shot to see if it works better for you? My impression is that MRO is doing some odd things that are going to make using it in this way a bit trickier.

1 Like

What your permissions for /srv/shiny-server looks like? something similar to this?

ls -la /srv/shiny-server

drwxrwsrwx 9 andres shiny-apps 4096 jun 23 14:39 .
drwxr-xr-x 4 root   root       4096 feb  3 20:41 ..
drwxrwsrwx 2 andres shiny-apps 4096 feb  3 20:44 almacen
1 Like

Thank you both. In the end, I've scraped together the instructions needed to un-install MRO (which takes down Microsoft R Server with it), install base R and Shiny (then put bac on non-Microsoft R Server). I've presently got a working R Server and working Shiny examples.

I don't know why there's this compatibility issue, and after so long since first reported. A cynic would eye up their Machine Learning machine subscription maybe.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.