[R] Solve for "Please set TMPDIR to a valid temporary directory"

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon May 10 16:13:33 CEST 2004


aedin culhane wrote:

> Dear R Help,
> My apologies if this is widely known, but I didn't find this in the R 
> archives. 
> 
> I am running WinXP pro and R 1.90.  Rcmd build or check fails with the 
> error: "Please set TMPDIR to a valid temporary directory"

OK. So why do you not set an environment variable TMPDIR=C:\Windows\temp
(which is the standard temp directory on Windows XP)?

Uwe Ligges


> $TMPDIR is set to $TMPDIR or C:/TEMP in share\perl\R\Var.pm.  TMPDIR or 
> c:\temp do not exist on WinXP on my laptop. I have C:\WUTemp and the 
> env variables $TMP and $TEMP are set (..Is this normal?).  
> 
> The two work arounds I found are to create a C:\temp directory, or 
> include $TMP or $TEMP in Var.pm. I did the latter, and it works for me. 
> I include the fix below.
> 
> 
> if($OSTYPE eq "windows"){
>     ## DON'T add R_HOME/bin here: it might contain spaces and will not
>     ## work using system() under Windows 98. 
>     $R_EXE = "Rterm.exe";
>     $R_CMD = "Rcmd.exe";
>     getenv("TMPDIR", "TMP", "TEMP", "C:/TEMP"); # Edited to include TMP 
> and TEMP
>     print "tmpdir is $TMPDIR\n";   # Edited to include print
>     if (-d $TMPDIR) {
> 	$TMPDIR = Win32::GetShortPathName($TMPDIR) if $TMPDIR =~ / /;
> 	$TMPDIR =~ s+\\+/+g;  ## ensure forward slashes only
>     } else {
> 	$TMPDIR = "" 
>     }
> }
> 
> 
> 
>>version
> 
> platform i386-pc-mingw32
> arch     i386
> os       mingw32
> system   i386, mingw32
> status
> major    1
> minor    9.0
> year     2004
> month    04
> day      12
> language R
> 
> 
> Regards
> Aedin
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list