Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
(/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 conda-envs]$ R -e 'Sys.getenv(c("R_PLATFORM", "R_HOME", "R_LIBS_USER", "R_LIBS", "R_LIBS_SITE"))'
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
...
> Sys.getenv(c("R_PLATFORM", "R_HOME", "R_LIBS_USER"))
  R_PLATFORM  "x86_64-conda-linux-gnu"
  R_HOME      "/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env/lib/R"
  R_LIBS_USER "/cluster/medbow/home/salexan5/R/x86_64-conda-linux-gnu-library/4.3"
  R_LIBS      ""
  R_LIBS_SITE "/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env/lib/R/site-library"
Note

Note: The platform string value is different: x86_64-conda-linux-gnu

...

Code Block
# Within R:
> install.packages("vctrs")
...
also installing the dependencies ‘cli’, ‘glue’, ‘lifecycle’, ‘rlang’
...
* DONE (vctrs)

...

Where was this installed?

Info

Check .libPaths():

Code Block
(/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 ~]$ R
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
...
> .libPaths()
[1] "/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env/lib/R/library"
Info

Since I own this Conda environment, I have permission to install under: /project/arcc/software/conda-envs/r_4.3.3_env/lib/R.

Lets check:

Code Block
[salexan5@mblog2 ~]$ ls /project/arcc/software/conda-envs/r_4.3.3_env/lib/R/library/
base  cli  compiler  datasets  glue  graphics  grDevices  grid  lifecycle  methods  
parallel  rlang  splines  stats  stats4  tcltk  tools  translations  utils  vctrs

...

But What about the R_LIBS_USER Environment Variable?

Info

Remember our environment variables:

Code Block
R_LIBS_USER "/cluster/medbow/home/salexan5/R/x86_64-conda-linux-gnu-library/4.3"
R_HOME      "/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env/lib/R"
Code Block
[salexan5@mblog2 ~]$ ls /home/salexan5/R/x86_64-conda-linux-gnu-library/4.3
ls: cannot access '/home/salexan5/R/x86_64-conda-linux-gnu-library/4.3': No such file or directory
[salexan5@mblog2 ~]$ ls /home/salexan5/R/
x86_64-pc-linux-gnu-library
Note

Why is /home/salexan5/R/x86_64-conda-linux-gnu-library/4.3 missing?

I own this Conda environment, so have permission to install under: Since this folder is missing, it is not being picked up and used by the .libPaths() command.

Info

If you manually create this folder then .libPaths() does pick it up.

Code Block
(/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env
/lib/R - lets check:
Code Block
) [salexan5@mblog2 ~R]$ ls /mkdir -p x86_64-conda-linux-gnu-library/4.3
(/cluster/medbow/project/arcc/software/conda-envs/r_4.3.3_env/lib/R/library/
base  cli  compiler  datasets  glue  graphics  grDevices  grid  lifecycle  methods  
parallel  rlang  splines  stats  stats4  tcltk  tools  translations  utils  vctrs
Info
The ~
) [salexan5@mblog2 R]$ R
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
...
> .libPaths()
[1] "/cluster/medbow/home/salexan5/R/x86_64-conda-linux-gnu-library/4.3"
[2] "/cluster/medbow/project/arcc/software/conda-envs/r_4.3
location is where R will additionally look for outside packages not directly part of this Conda environment
.3_env/lib/R/library"
Info

Using the install.packages() command within R will now look/install packages into this folder that could be shared across multiple Conda environments using this version of R.

...

Try Installing stringi Package

...

Info

The Conda install of the R package is installed within the same location as the R install.packages() function.

/project/arcc/software/conda-envs/r_4.3.3_env/lib/R/library/

...

Warning: Conda related R_LIBS_USER - Check!

Info

Question: Should you manually create the ~/R/x86_64-conda-linux-gnu-library/X.Y/ folder?

Note

First, we would suggest that unless you are confident in self-managing your Conda/R environments then do not.

If this is not in your .libPaths(), then it will force all R package installs to be contained under the Conda environment.

Note

If this path IS in your .libPaths(), across multiple conda environments, then all the environments will install/share this folder.

You can run into dependency/version issues is you want to use version X of a package in one Conda environment, but version Y in another. You can only have one version in this folder.

Note

We have observed that some times this folder have been automatically created.

Best thing is to always check and set the .libPaths() to you necessary needs.

...

Anaconda: R Essentials

Although we do not recommend installing Anaconda (unless you are comfortable with how it works and modifies your home environment), it does provide an R Essentials bundle which “includes approximately 80 of the most popular scientific packages for the R programming language.

...