Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If rlang have newer source version for windows, install_github could fail because of locking #2223

Closed
dracodoc opened this issue May 5, 2020 · 5 comments

Comments

@dracodoc
Copy link

dracodoc commented May 5, 2020

I have rlang 0.4.5 binary installed

> install.packages("rlang")
Installing package intoD:/Lib/R_user_lib’
(aslibis unspecified)

  There is a binary version available but the source version is later:
      binary source needs_compilation
rlang  0.4.5  0.4.6              TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_0.4.5.zip'
Content type 'application/zip' length 1112530 bytes (1.1 MB)
downloaded 1.1 MB

packagerlangsuccessfully unpacked and MD5 sums checked

while installing a package with install_github, I chose to only update CRAN packages,

> devtools::install_github("ctmm-initiative/ctmmweb")
Downloading GitHub repo ctmm-initiative/ctmmweb@master
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                          
2: CRAN packages only           
3: None                         
4: rlang (0.4.5 -> 0.4.6) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
2
rlang        (0.4.5 -> 0.4.6   ) [CRAN]

then it will ask me

There is a binary version available (and will be installed) but the source version is later:
binary source
rlang 0.4.5 0.4.6

I chose Not to install from source, then it will download 0.4.5 and try to install it again, even I already have 0.4.5 installed. In the end the package installation will fail.

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_0.4.5.zip'
Content type 'application/zip' length 1112530 bytes (1.1 MB)
downloaded 1.1 MB
...
packagerlangsuccessfully unpacked and MD5 sums checked
Error: Failed to install 'ctmmweb' from GitHub:
  (converted from warning) cannot remove prior installation of packagerlang

I cannot pass this failure loop unless I chose to install rlang 0.4.6 from source.

I think the problem is, once the process scheduled to install 0.4.6, even user chose not to install from source, it will try to install binary version even there is a same version binary package installed already. Then somehow this will cause problem.

Either don't try to install the same version binary, or fix the problem of installing same version binary again will fix this.

@jennybc
Copy link
Member

jennybc commented May 5, 2020

You might find this issue helpful, for this case and just in general as a Windows user:

rstats-wtf/what-they-forgot#62

@dracodoc
Copy link
Author

dracodoc commented May 5, 2020

Yes I knew I often need to restart R session for package loading/unloading errors. I did restart session before each command. With the commands I shown above, I just install rlang but didn't load it. I also restarted the R session right before running devtools::install_github, which is the first thing I do when I met package installation problems.

To verify it again, I just started from scratch again, still same result.

The issue is as I described, devtools will install rlang when option "CRAN only" is selected, even after user chose not to install source later.

Interestingly, using remotes::install_github don't have this problem.

@dracodoc
Copy link
Author

dracodoc commented May 5, 2020

I think I knew why. With remotes::install_github it's the same, it also planned to install rlang, and go ahead to install rlang 0.4.5 binary again when I chose not to install source newer version.

However rlang is not loaded so remotes can install it again without problem.

With devtools, rlang is loaded by devtools (even I restarted R session, didn't load devtools, only used devtools::install_github), so it cannot install rlang again.

I think I met this problem before. Whenever there is a rlang newer source version in windows, I met this problem with devtools::install_github. I have to install the source version to solve this. This is not a big problem for me, but our webapp was supposed to be used many users that not too familiar with R, they will not be able to handle this kind of problems (they probably cannot install Rtools in windows and install package from source too, which will bring more problems).

@jennybc
Copy link
Member

jennybc commented May 5, 2020

rlang is used by devtools, so even though you don't load it, the use of devtools::install_github() does. So, yes, for the "rlang + Windows" combo, remotes::install_github() will be more robust to these DLL locking issues.

@dracodoc dracodoc changed the title package with latest binary version installed but have newer source version caused installation failure loop If rlang have newer source version for windows, install_github could fail because of locking May 5, 2020
@dracodoc
Copy link
Author

dracodoc commented May 5, 2020

I changed the title to better reflect the issue. The problem now is

  • if user have latest binary installed and chose not to install source version, should not try to install binary version again. This doesn't cause problem in normal cases, but is still not right.

The temporary solution is to ask user to use remotes instead, but I think the logic can be improved and solve this kind of problem all together. I will submit a issue in remotes since it should belong to remotes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants