R studio connect 'Unable to start device PNG'

Hello all, could you please help out a friendly sysadmin with next to no R knowledge :slight_smile:

I'm admin of an R studio connect instance. I often get the complaint of users that their application does not show figures when deployed on the server. A usual error looks like:

unable to open connection to X11 display ''

05/30 16:03:22.131 (GMT)

Error in .External2(C_X11, paste0("png::", filename), g$width, g$height, :

05/30 16:03:22.131 (GMT)

unable to start device PNG

With trial and error from some friendly users I was able to figure out that adding


To the shiny UI code fixes this problem.

However it is quite tiresome for me as an admin to have to repeat this fix every time the user has this problem (it happens to almost every new user). Unfortunately I don't know enough about R libraries to understand the problem.

Could anyone advise if there is a server setting or package that I need to configure so that this 'fix' is not necessary anymore? I'm guessing it has something to do with the default display in R studio vs. R studio connect?

Many thanks for any advice!

Howdy @erikvdbergh !! Apologies for the long delay getting back to this! And welcome!

How did you install R on the server? Usually this is related to either a system dependency missing or a compile flag being set wrong when compiling R from source. I have seen incidence of this issue all but disappear since we started shipping our own binaries:

That said, I have forgotten many of the specifics, but maybe there are other threads on the community that discuss a more systemic fix? I can definitely relate to the annoyance / frustration with this issue!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.