Cannot install any packages, unable to translate to native coding

Whenever I open Rstudio I get this message in red:
"Error in gzfile(file, mode) : cannot open the connection
In addition: Warning messages:
1: In list.files(cacheDir) :
unable to translate 'C:/Users/<U+03A7>a<U+03C1><U+03B7><U+03C2>/AppData/Local/RStudio/explorer-cache' to native encoding
2: In gzfile(file, mode) :
cannot open compressed file 'C:\Users\×áñçò\AppData\Local\Temp\RtmpEZExey\rstudio-available-packages-23783cacb6/time.rds', probable reason 'No such file or directory'".

My PC user name is written in a foreign language, but as you can see from the above text, Rstudio writes it as "×áñçò" wrongfully.

Whenever I try to install a package, Rstudio doesn't respond at all, and when I try to close it I get the message "Retrieving package installation context..." and I am stuck there for a while until I get this error in the console:
"WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
cannot create dir 'C:\Users\×áñçò\AppData\Local\Temp\Rtmpw9xEQw\downloaded_packages', reason 'No such file or directory'
Error in install.packages : unable to create temporary directory ‘C:\Users\×áñçò\AppData\Local\Temp\Rtmpw9xEQw\downloaded_packages’"

I have tried everything, from reinstalling, from running Rstudio as an administration but none of these work! Could you please help me?

Thank you.

See https://forum.posit.co/t/error-for-installing-packages/39169 .
Maybe reading that will give you some ideas.

I did all of those things and I am still getting this. I also cannot change my PC username...

In addition to changing your lib path within R, you should (according to the error message you shared) change your windows temp path to also not include the problematic symbols. How to Move Windows’ Temporary Folders to Another Drive

In addition to the post of @nirgrahamuk I think it would be helpful to let the R_LIBS_USER system variable point to the folder where you would like to install the packages. Then it is clear where to install the packages (and find them) without specifying this for each install. See the image that list part of my environent variable setting (as described in the link in the posting of @nirgrahamuk). You see there that I use a fixed (non R-version dependent name).
Two musings on my side (but happily I have an ascii username) :

  • (how) are the base packages found in the non-ascii case? Should these be moved/copied from the default location to the user install folder?
  • I see the TEMP and TMP variable in both the user and the system part. In think the user definitions can be removed but I am not willing to try it :sweat_smile:

Succes with solving your problem.

Thank you both for your help.

I just changed my windows temp and tmp path to my Google drive and I no longer get the error message that I used to get when opening Rstudio. Moreover, I am now able to install packages, though I do get a warning message at the end.

I did not change my lib path within R nor did I mess around with anything else like the R_LIBS_USER, however. I am not sure if this will present problems in the future?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.