'R Studio Fatal error: 'R_TempDir'contains space

I tried to download the latest version (4.2.0) of R on my windows computer and received this error message upon trying to open the program. "Fatal error: 'R_TempDir' contains space". Has anyone ever had this issue or have any ideas on how to resolve it? I have tried reinstalling the program and moving where the program is stored but no luck.



Solution 1:[1]

I also experienced this issue with 4.2.0 of R on Windows 10 but not prior versions of R.

In my case, the reason was the default temporary file folder was within my user directory and my user ID has a space in it. Apparently this causes an issue.

I was able to work around it by setting the global environment variable TMPDIR in windows:

  1. Go to the search box next to the start button and type "environment"
  2. Click on the choice which says "Edit the system environment variables"
  3. Click the button that says "Environment Variables" near the bottom of the window
  4. Click "New" and enter TMPDIR for variable name and some suitable directory without spaces under variable value (I chose C:\Temp)

As an aside, I do not believe this is an RStudio specific issue (and 4.2.0 isn't a version for RStudio anyway).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Venk Murthy