yihui / xfun

Miscellaneous R functions
https://yihui.org/xfun/
Other
141 stars 28 forks source link

xfun update failed for many times #50

Closed duytrung closed 3 years ago

duytrung commented 3 years ago

By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

Hi YiHui,

I have tried to update the package xfun for some times but not successful. Here is the log of the program in the console:

> install.packages('xfun')
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/xfun_0.22.zip'
Content type 'application/zip' length 327581 bytes (319 KB)
downloaded 319 KB

package ‘xfun’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot remove prior installation of package ‘xfun’
Warning in install.packages :
  problem copying C:\Anaconda\Others\R\library\00LOCK\xfun\libs\x64\xfun.dll to C:\Anaconda\Others\R\library\xfun\libs\x64\xfun.dll: Permission denied
Warning in install.packages :
  restored ‘xfun’

The downloaded binary packages are in
    C:\Users\user\AppData\Local\Temp\RtmpSmXztt\downloaded_packages

I came to the folder but found the dll file remain the same.


OS: Windows 10.
R version: 4.0.4.
RStudio: 1.4.1103
Can you please show me how to fix this?

Thank you very much
cderv commented 3 years ago

On windows, updating package with source code can be tricky because of the dll issue.

You need to be sure to use a clean session, with nothing loaded and even outside of RStudio - this is to avoid having xfun package loaded in anyway in your session or in another session. This is a known constraint on windows

That is why I advice now to you use the new pak package which greatly improve this experience on Windows: It will detect any other sessions where a package could be loaded and could cause a dll lock issue.

See https://pak.r-lib.org/

Can you try :

install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
pak::pak("xfun")

If you don't want to use pak

Hope it helps

duytrung commented 3 years ago

hi @cderv , I just know about pak by your reply and have opened the link to the pak page. It's interesting. I would try tomorrow to see if I can fix the installation myself. Thank you very much