## WeBWorK Main Forum

### Rserve Error in plot.new()

by Nandor Sieben -
Number of replies: 3
Some of the pg files using R to generate images produce errors. The Rserve connection seems to be working for other problems requiring R. An example of a pg file that does not work is this:
Library/UBC/STAT/STAT300/hw06/stat300_hw06_q01.pg

It produces the error:
ERRORS from evaluating PG file:
Error in plot.new() :
could not open file '/tmp/RtmpBSRSTN/file7cbaebab4ac.png'
Died within Rserve::try_eval called at line 146 of [PG]/macros/RserveClient.pl
from within main::rserve_eval called at line 54 of (eval 4062)

It seems that the png file was created successfully. Where exactly should this file be? Isn't /tmp/Rserv the working directory of Rserve ? Is '/tmp/RtmpBSRSTN/file7cbaebab4ac.png' refer to a subdirectory of the webwork directory structure?

### Re: Rserve Error in plot.new()

by Danny Glin -
This problem works fine on my server, and the graphic loads fine.

The first thing to try would be to restart Rserve. I've had this happen to me before where R stops creating images, but everything else using Rserve continues to work. The remedy has been to restart Rserve.

A quick look around indicates that /tmp/Rtmp... is an absolute path used by R for temporary files, and has nothing to do with WeBWorK. If you're having problems with files there, I suggest checking the permissions on the /tmp directory (which I'm guessing haven't changed recently), and also making sure that the disk partition containing /tmp isn't full.

### Re: Rserve Error in plot.new()

by Nandor Sieben -
Thank you. Restart cured the problem:

sudo killall -INT Rserve
R CMD Rserve

followed by apache restart.
ERRORS from evaluating PG file:
Error in png("/tmp/RtmpwNeW25/fileb138530009e4.png", width = , height = ) : X11 is not available Died within Rserve::try_eval called at line 146 of [PG]/macros/RserveClient.pl from within main::rserve_eval called at line 175 of [PG]/macros/RserveClient.pl from within main::rserve_start_plot called at line 53 of (eval 3615)