Versions Compared

Key

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

...

Info

General Process:

Code Block
[salexan5@mblog2 ~]$ cd /project/arcc<project-name>/software/conda-envs/
[salexan5@mblog2 conda-envs]$ module purge
[]$ module load miniconda3/24.3.0
[salexan5@mblog2 conda-envs]$ conda search r-base
Loading channels: done
# Name                       Version           Build  Channel
...
r-base                         4.3.3      hf0d99cb_1  conda-forge
...
r-base                         4.4.1      h1dca405_0  conda-forge
[salexan5@mblog2 conda-envs]$ conda create -p r_4.3.3_env r-base=4.3.3
[salexan5@mblog2 conda-envs]$ conda activate /cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env
(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 conda-envs]$ R --version
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
...
Info

Note: The conda environment was created using the -p option, so it was installed under the current working directory, which in the case was: /project/arcc/software/conda-envs

...

Where are Packages Installed?

...

Code Block
(/cluster/medbow/project/arcc<project-name>/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<project-name>/software/conda-envs/r_4.3.3_env/lib/R"
  R_LIBS_USER "/cluster/medbow/home/salexan5<username>/R/x86_64-conda-linux-gnu-library/4.3"
  R_LIBS      ""
  R_LIBS_SITE "/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env/lib/R/site-library"

...

Code Block
(/cluster/medbow/project/arcc<project-name>/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<project-name>/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<project-name>/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

Remember our environment variables:

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

...

Code Block
(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 R]$ mkdir -p x86_64-conda-linux-gnu-library/4.3
(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 R]$ R
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
...
> .libPaths()
[1] "/cluster/medbow/home/salexan5<username>/R/x86_64-conda-linux-gnu-library/4.3"
[2] "/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env/lib/R/library"

...

Note

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

You can run into dependency/version issues is if 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.

...

Code Block
# Within R:
> install.packages("stringi")
...
configure: error: in `/tmp/RtmpVm7ias/R.INSTALL2ad60710733cd2/stringi':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env/lib/R/library/stringi’

The downloaded source packages are in
        ‘/tmp/Rtmpio5YFH/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("stringi") :
  installation of package ‘stringi’ had non-zero exit status

...

Code Block
(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 conda-envs]$ conda search stringi
Loading channels: done
No match found for: stringi. Search: *stringi*
# Name                       Version           Build  Channel
r-stringi                      0.4_1        r3.1.3_0  pkgs/r
...
r-stringi                      1.8.4   r43hbd1cc82_0  conda-forge

(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 conda-envs]$ conda search r-stringi
Loading channels: done
# Name                       Version           Build  Channel
r-stringi                      0.4_1        r3.1.3_0  pkgs/r
...
r-stringi                      1.8.4   r43hbd1cc82_0  conda-forge
Info

Remember: Conda r packages use the naming convention: r_-<package-name>

...

Conda Install stringi Package

Code Block
(/cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env) [salexan5@mblog2 conda-envs]$ conda install r-stringi
Channels:
 - conda-forge
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##
  environment location: /cluster/medbow/project/arcc<project-name>/software/conda-envs/r_4.3.3_env
  added / updated specs:
    - r-stringi

The following NEW packages will be INSTALLED:
  r-stringi          conda-forge/linux-64::r-stringi-1.8.4-r43hbd1cc82_0
...
Executing transaction: done

...

Where was this installed?

Info

The conda install command (whatever the type of package/library) installs within the conda environment .

Code Block
[salexan5@mblog2 ~]$ ls /project/arcc<project-name>/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  stringi  tcltk  tools  translations  utils  vctrs

...

Code Block
conda install -c r r-essentials

...