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

version subdir not created when trying to install package for new R version #1904

Closed
enrichilversum opened this issue Oct 27, 2023 · 1 comment

Comments

@enrichilversum
Copy link

enrichilversum commented Oct 27, 2023

I came across this issue from one of our users. He was trying to install a package from a git repo using devtools/install_github()

Important background: We are working on a large cluster using EasyBuild modules, the software was installed and compiled centrally. I am not the maintainer or sysadmin. Both versions, 4.1 and 4.2 are used by a large user pool, so that we can safely assume that these are correct. Our users have no root or sudo rights.

We both, the user and I, were able to install the package for version 4.1 without a problem. For version 4.2, though, I was able to install it on my home directory without any serious complaint. But I was unable to do so, logging in as the user. I got the error below. I will omit some verbosity as it is not really relevant, and I will obfuscate the GIT repo and package name, as this is a personal package from the user's own repo, and it is not yet public:

Brief description of the problem

> library(devtools)
Loading required package: usethis
> install_github("foo/BarModel")
Downloading GitHub repo foo/BarModel@HEAD
[...]
Warning in i.p(...) :
 'lib = "/gpfs/admin/_hpc/sw/arch/AMD-ZEN2/RHEL8/EB_production/2022/software/R/4.2.1-foss-2022a/lib64/R/library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) yes
Error: ERROR: no permission to install to directory/gpfs/admin/_hpc/sw/arch/AMD-ZEN2/RHEL8/EB_production/2022/software/R/4.2.1-foss-2022a/lib64/R/libraryWarning message:
In i.p(...) :
 installation of package/scratch-local/userx/RtmputmZ17/file19bc5e14ccc6f9/BarModel_0.1.0.tar.gzhad non-zero exit status
> q()

Note: The library /gpfs/etc/etc is not writable. This is not a bug.
Note2 userx does, of course, not exist (not relevant either, but yet)

After checking the user's $PATH and a few more possible issues, I figured out that the install_github method was simply not creating the subdirectory /home/userx/R/x86_64-pc-linux-gnu-library/4.2

After creating it manually, the installation worked perfectly.

TL;DR : Please check if this is an issue of isntall_github only and ensure that if the version subdir does not exist, it will be created.

@jennybc
Copy link
Member

jennybc commented Oct 27, 2023

R, in general, does not automatically create all of the standard library locations that it automatically consults. I think on Windows (?) this might be automatic, so, depending on one's most-used OS, it is possible to not really be aware of this.

I recommend reading this section of the R Installation and Administration manual:

https://rstudio.github.io/r-manuals/r-admin/Add-on-packages.html#managing-libraries

especially these bits (bold is mine):

R will automatically make use of a site-specific library R_HOME/site-library (if this exists (it does not in a vanilla R installation). This location can be overridden by setting .Library.site in R_HOME/etc/Rprofile.site, or (not recommended) by setting the environment variable R_LIBS_SITE.

Users can have one or more libraries, normally specified by the environment variable R_LIBS_USER. This has a default value (to see it, use Sys.getenv("R_LIBS_USER") within an R session), but that is only used if the corresponding directory actually exists (which by default it will not).

My personal approach to this is what's described here:

https://rstats.wtf/maintaining-r#how-to-transfer-your-library-when-updating-r

(This is an issue of how base R works, so not really an issue with usethis (this repo) or devtools or remotes, etc.)

@jennybc jennybc closed this as completed Oct 27, 2023
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