An error has occurred... pngfun X11

I'm trying to publish a sample Shiny app from RStudio Server to a new RStudio Connect server. The app works fine in the IDE but when launching it on Connect the UI controls are visible and functional but the plot does not, and the following error appears.

An error has occurred. Check your logs or contact the app author for clarification.

The log shows:

2018/06/21 15:01:55.394809822 Warning: Error in pngfun: X11 is not available
2018/06/21 15:01:55.400168006   135: pngfun
2018/06/21 15:01:55.400170441   134: startPNG
2018/06/21 15:01:55.400186292   133: drawPlot
2018/06/21 15:01:55.400187705   119: <reactive:plotObj>
2018/06/21 15:01:55.400206628   103: drawReactive
2018/06/21 15:01:55.400208048    90: origRenderFunc
2018/06/21 15:01:55.400217859    89: output$distPlot
2018/06/21 15:01:55.400219078    13: runApp
2018/06/21 15:01:55.400228817    12: fn
2018/06/21 15:01:55.400230047     7: connect$retry
2018/06/21 15:01:55.400239665     6: eval
2018/06/21 15:01:55.400240940     5: eval

Any ideas or anywhere else I should look for more information?

I found that the R option for bitmapType on the RStudio Server was set to "cairo" but on the RStudio Connect server it was set to "xlib" even though R was configured without X11 support.

R was installed via yum on the RStudio Server and from source on the RStudio Connect server.

Is there a better way to do this? And change the option server-wide?

We recommend that you install R from source, both for RStudio Connect and RStudio Server Pro. This is the only way to be sure your code will run on the version of R you intended, rather than the system R (provided by yum).

Since you have already built R from source on this machine, it may be as simple as changing the RStudio Server config file to point to the location where you installed R (from source).

See the admin guide Section 6 R versions for instructions. Specifically, you can define the installed versions in the file /etc/rstudio/r-versions, as described in Section 6.4.1. For example:


@hansen_m: @andrie

I tried the above approach setting R from source; but it still throws the same error:
Were you able to resolve this?

Warning: Error in pngfun: X11 is not available.

The R Installation and Administration Manual discusses X11 issues in section C.1.

The manual states that X11 is the graphics device on Linux, and that:

"The ‘modern’ version of the ‘X11()’ device is based on ‘cairo’ graphics..."

The manual also describes Building the cairo devices in section 3.1.4, and that the instruction for doing this is:

make cairodevices

The full paragraph from the manual:

The devices based on cairographics (svg, cairo_pdf, cairo_ps and the type = "cairo" versions of png, jpeg, tiff and bmp) are implemented in a separate DLL winCairo.dll which is loaded when one of these devices is first used. It is not built by default, and needs to be built (after make all) by make cairodevices.
To enable the building of these devices you need to install the static cairographics libraries built by Simon Urbanek at Set the macro ‘CAIRO_HOME’ in MkRules.local. (Note that this tarball unpacks with a top-level directory src/: ‘CAIRO_HOME’ needs to include that directory in its path.)

I hope these instructions help to resolve your problem.

1 Like

Hi All, Thank you for your help.

I have fixed the issue. cairo library was missing