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

checking for already installed does not respect lib argument #121

Open
lshep opened this issue Nov 17, 2021 · 4 comments
Open

checking for already installed does not respect lib argument #121

lshep opened this issue Nov 17, 2021 · 4 comments

Comments

@lshep
Copy link
Contributor

lshep commented Nov 17, 2021

So I'm testing locally and I have an environment variable set up to specify a different installation path:

> .libPaths()
[1] "/home/shepherd/R-Libraries/4.2-Bioc3.15"      
[2] "/home/shepherd/R-Installs/bin/R-devel/library"

I need biocViews to be installed directly in the second location which it does not do because I assume its finding it in the first despite me explicitly asking for installation

> install("biocViews", lib=.libPaths()[2])
Bioconductor version 3.15 (BiocManager 1.30.16), R Under development (unstable)
  (2021-10-27 r81106)
Warning message:
package(s) not installed when version(s) same as current; use `force = TRUE` to
  re-install: 'biocViews' 

> system("ls /home/shepherd/R-Installs/bin/R-devel/library")
base   cluster	  datasets  grDevices	lattice  methods  nnet	    spatial  stats4    tools
boot   codetools  foreign   grid	MASS	 mgcv	  parallel  splines  survival  translations
class  compiler   graphics  KernSmooth	Matrix	 nlme	  rpart     stats    tcltk     utils

Granted I can do a force=TRUE to get around this but it seems like the checking should be limited if lib is given

@LiNk-NY
Copy link
Contributor

LiNk-NY commented Nov 22, 2021

Hi Lori,
I think in general, .libPaths()[2] the default installation packages should be untouched but I am not familiar with your use case.

For one off installations, you can use install.packages

install.packages("biocViews", repos = BiocManager::repositories(), lib = .libPaths()[2])

or set an R_LIBS_USER=/home/shepherd/R-Installs/bin/R-devel/library environment variable so that the path is the only option.

When we check whether a package is up to date, we don't do it within each lib but across all libs as given by instPkgs <- install.packages(). And then we pass the lib argument to install.packages. So another option is to modify the .libPaths() but a bit cumbersome.

@lshep
Copy link
Contributor Author

lshep commented Nov 22, 2021

again -- i needed it to a specific path which I specified with lib but it wouldn't do it without a force =TRUE becasue it found it in a different lib

@LiNk-NY
Copy link
Contributor

LiNk-NY commented Nov 22, 2021

That's due to installed.packages checking in all your .libPaths(). If you want to restrict to one folder then a set up change with R_LIBS_USER should work.
I'm not sure why you need it in the default R packages location but if you could explain, that would help.

A change considering lib as an input would have to modify installed.packages and other parts of the code and may be best resolved with setting the environment variable or modifying .libPaths(). This is not a typical use case AFAICT.

Note. The other option is to remove the biocViews installation in .libPaths()[1] before installing in the other location.

@lshep
Copy link
Contributor Author

lshep commented Nov 22, 2021

its specific to the single package builder and certain packages required for the SPB to run correctly being installed in the default location.
Again it seemed to me wrong to look in all libPaths if a specific one is identified and passed on. I agree this should be the default behavior but I would think that if I'm checking for a package in a specified libPath than the check would be restricted to that location too.

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