I installed conda as described in the wiki. conda-shell opens a shell, in which all conda-related commands work as expected (i.e. working with python environments works flawlessly). However, installing an R environment leads to a broken R installation: It seems that several standard-libraries cannot be found by the R interpreter:
(base) conda-shell-chrootenv:moritz@moxps:~$ conda create -n r_env r-essentials r-base
... everything installs fine ...
(base) conda-shell-chrootenv:moritz@moxps:~$ conda activate r_env
(r_env) conda-shell-chrootenv:moritz@moxps:~$ R
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Error: package or namespace load failed for ‘utils’:
.onLoad failed in loadNamespace() for 'utils', details:
call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
error: error in running command
Error: package or namespace load failed for ‘stats’:
.onLoad failed in loadNamespace() for 'utils', details:
call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
error: error in running command
During startup - Warning messages:
1: package ‘utils’ in options("defaultPackages") was not found
2: package ‘stats’ in options("defaultPackages") was not found
I failed in finding similar errors on the web, so I suspect it’s a nixos-specific error, however I am completely out of ideas on how to find out why R cannot find these packages. utils for example seems to be present in the environment:
Shoot. There are a couple of other environment variables to try, plus the .libPaths() function which shows the full list of search paths (might be helpful for debugging).
Thank you @roni.
libPaths seems to point to the correct location. I was reading a bit about the other environment variables, but didn’t see a light. I’m trying to use the nix-version of R for now. Thank you for the support!!
R depends on which, which might not be present in the conda R environment. Maybe it could be as simple as to add the which-derivation to conda?
Placing ‘which’ into the conda binary folder did however not fix the issue (the R console still complains about not being able to load stats and utils packages)
mach-nix looks great! Thanks for pointing me to it @igel. Unfortunately, I am using a system that requires conda (snakemake) to run the way I want it to.
@GTrunSec although it heavily looks like this is the issue for me, I still get the same error even after setting R_HOME (it was indeed unset before…):