Skip to content

Issues with TMPDIR/TEMP/TMP? Failure of R CMD check under Windows 7

10 messages · Duncan Murdoch, Jeff Newmiller, Gabor Grothendieck +1 more

#
Dear helpeRs,

on my Windows 7 laptop, I have problems getting R CMD check to work. I 
believe it did work completely before, but I am not sure.

Yesterday it almost worked, except for the tests: These were aborted 
because of a complaint that the temporary directory wasn't available. I 
played with windows environment variables for the temporary directory, 
but that didn't solve it. Apparently I did something that made things worse:

Today, R CMD check completely refuses to work, with the error message 
"Fatal error: creation of tmpfile failed -- set TMPDIR suitably?" This 
is the same for current R and R-devel. Changes to the TEMP or TMP 
environment variable don't influence this behavior.

The path:
C:\Rtools;C:\Program Files\Dell\DW WLAN Card;C:\Program 
Files\R\R-2.15.2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program 
Files\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files\WIDCOMM\Bluetooth 
Software\;C:\Program Files\Calibre2\;C:\Program Files\MiKTeX 
2.9\miktex\bin\;C:\Program Files\TortoiseSVN\bin

Any ideas what I can do to fix this?
Perhaps also relevant: I run R CMD check from a DOS window that is 
opened with administrator rights.

Best, Ulrike
#
On 13-02-24 4:00 PM, Ulrike Gr?mping wrote:
With the default install, there are no executables in C:\Rtools.  They 
are normally in C:\Rtools\bin and C:\Rtools\gcc-4.6.3\bin.  But this 
probably isn't causing the problem.  It sounds as though you've set the 
temporary directory to something that doesn't exist, or somewhere you're 
not allowed to write.

Can you still start R?  If so, what does tempdir() show?  Mine shows

[1] "C:\\temp\\RtmpGeoCGq"

The random bit at the end would be different for each session.  The part 
before needs to be a path in which you have write permission.
You should start R from the same window, using just "R" or "Rgui" to 
make sure it sees the same environment.

Duncan Murdoch
#
Am 24.02.2013 22:14, schrieb Duncan Murdoch:
Actually, I can't start R any more (Error: mkdir R_TempDir does not 
work). And it appears that changing the TEMP and TMP environment 
variables in Windows does not really affect the choice of TempDir in R ? 
Yesterday, the complaint was always related to a random directory name 
within the default temporary directory, and there are many such 
directories in that path (I would have thought that these are deleted 
when shutting the machine down, but apparently the are not), so there 
must have been write permission in there once. Today everything is 
different, perhaps because of something I did yesterday but don't 
remember any more.

If all else fails, I suppose the fastest thing may be a complete 
re-install of R.

Best, Ulrike
#
If you do reinstall, I recommend not using administrator mode at all. Let the install program trigger a request for password to enable the install, and run R as a normal user, doing your work in subdirectories of your Documents directory. Running as administrator is like heroin... any problems it solves it replaces with worse problems.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
"Ulrike Gr?mping" <groemping at bht-berlin.de> wrote:

            
#
On Sun, Feb 24, 2013 at 4:00 PM, Ulrike Gr?mping
<groemping at bht-berlin.de> wrote:
1. Remove the paths to Rtools and to R in PATH since they don't look correct.

2. Enter this from the Windows cmd line:
SET U
SET T

and it should show that TMP is set to %userprofile%\AppData\Local\Temp
and that TEMP is set to the same thing and TMPDIR is not listed.
If not change them so that it so reads.

3. Once you have done all the above then place this file anywhere on your path

https://batchfiles.googlecode.com/svn/trunk/R.bat

The following will find R using the registry or if its not there it
will look in the usual places and then run it so you can then try:

R.bat CMD ...whatever...

If that still does not work proceed to the following manual alternative:

4. If the above did not fix the problem download this file

https://batchfiles.googlecode.com/svn/trunk/Rpathset.bat

5. edit the SET statements in it and then place it on your Windows path.

6. Now run it from the cmd line:

Rpathset.bat

and for the rest of that cmd line session your path should be set up correctly.


Also you might want to read:

https://batchfiles.googlecode.com/svn/trunk/batchfiles.md

There is also a new discussion group just set up at
https://groups.google.com/forum/?fromgroups#!forum/sqldf
that is also being used for the batchfiles.
#
Am 24.02.2013 23:50, schrieb Gabor Grothendieck:
Thanks, I followed your advice, and the check ran from the R.bat; also, 
the R Gui was usable again. After re-adding the paths to Rtools and R 
manually (I think they were correct anyway), I am back to the sunday 
state: R Gui runs fine, the check is run, except for the tests where the 
complaint is:
cannot open file 
'c:\Users\GROEMP~1\AppData\Local\Temp\Rtmp8kETwo\file15d8714c5215': 
Permission denied
(Of course, the proper path is with groemping instead of GROEMP~1; the 
abbreviation is done automatically by R CMD check or Windows.)

 From the Dos box, I can cd to that directory (both long name and 
abbreviated name), and there is a 0 byte file of the name in the 
complaint. From the Windows 7 Explorer, I don't know how to change to 
that directory, except for a search for the file name. Once I have found 
the file name, I can edit and change the file without being stopped from 
doing so, thus this does not seem to be an issue of write permissions.

Any idea how to fix this, without a re-installation (that might not fix 
it either, if I am unlucky)?
And, by the way, do others agree with Jeff's advice (thanks, Jeff!) that 
it is preferrable not to install and run R with administrator rights?

Best, Ulrike
#
On Sun, Feb 24, 2013 at 6:34 PM, Ulrike Gr?mping
<groemping at bht-berlin.de> wrote:
1. There is something wrong with the permissions on the TEMP directory
unrelated to R. Remove everything in that directory and make sure that
you have write permission on TEMP.  Its probably easier to do that
through Windows Explorer.

2. Regarding the comment on the paths, I don't think the Tools or R
paths were correct. The tools path should end end in bin but it did
not. Also there are additional components for gcc that I think were
missing.   Also the R path ends in x64 (or i386 if you want 32 bit)
but yours ended in bin.  Note that if you use R.bat or Rpathset.bat
consistently you don't have to set up your path in the first place.
Its basically configuration-free.

R.bat show

will show the values its heuristic found.

3. Regarding Admin rights I think its best to keep everything as
standard as possible which means installing R itself into C:\Program
Files\... tree which is where it goes by default and that requires
Admin rights to do.
#
Gabor,

thanks for your patient answers! I have adjusted the Rtools path to 
consist of both
the bin and the gcc-4.6.3 sub directory, and that did it. The R path was 
set by R as it was,
presumably because this is only a 32-bit system, and everything worked 
with that R path, as there is also an R.exe in the path without the i386.

I have no idea what these path settings might have to do with write 
permissions on the temp directory, but as long as it works ...

Best, Ulrike

Am 25.02.2013 01:29, schrieb Gabor Grothendieck:
#
On Mon, Feb 25, 2013 at 2:10 AM, Ulrike Gr?mping
<groemping at bht-berlin.de> wrote:
On my machine Rgui.exe is found in ..\bin\x64 and the 32 bit version
is found in ..\bin\i386 and there is no Rgui.exe in ...\bin .  Ditto
for RSetReg.exe, Rterm.exe and maybe a few others.  Thus if yours is
the same then using a path to R ending in bin still won't let you run
Rgui.exe (and ditto for a few other executables) from the cmd line.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
#
Am 25.02.2013 18:21, schrieb Gabor Grothendieck:
That's probably true, but I never run the GUI from command line, I 
always use the icons on the desktop that point to the correct exe.
All I ever use from the command line is R CMD build, check and INSTALL, 
which works fine with that path.

Best, Ulrike