Hi,
After installing RStudio, I found I can’t install any R packages using install.packages
in RStudio.
> install.packages("ggplot2")
Installing package into '/home/alienzj/R/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.5.1.tar.gz'
Content type 'application/x-gzip' length 3604371 bytes (3.4 MB)
==================================================
downloaded 3.4 MB
/nix/store/rnwcrgsychzvn02g4p2b4xqij50xi98z-R-4.4.1/lib/R/bin/R: line 144: exec: sh: not found
Warning in install.packages :
error in running command
Warning in install.packages :
installation of package 'ggplot2' had non-zero exit status
May I know anyone meet similar issue?
maybe you could install R
in your configuration.nix
like this:
{ config, pkgs, lib, ... }:
let
rEnv = rWrapper.override {
packages = with rPackages; [
ggplot2
];
};
in
{
environment.systemPackages = [
rEnv
];
}
Thanks.
Yes, I did it using nix way.
In some conditions, I want to call install.packages
to install some packages, then R always return line 144: exec: sh: not found
. Maybe there are some issue in R wrapper.
Installing imperatively is probably not supported, you need to do it the nix way always. Though I’m not in the R portion of nixpkgs, so my opinion is not conclusice
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
6: Setting LC_PAPER failed, using "C"
7: Setting LC_MEASUREMENT failed, using "C"
Installing 'ggh4x' ...
Installing package into '/home/alienzj/R/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ggh4x_0.2.8.tar.gz'
Content type 'application/x-gzip' length 1308196 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
/nix/store/35ws8rzvrjhg9vr1sv05kh30401c25vw-R-4.4.1/lib/R/bin/R: line 144: exec: sh: not found
The downloaded source packages are in
'/tmp/RtmpvumYo1/downloaded_packages'
<U+2714> Package 'ggh4x' successfully installed.
Warning messages:
1: In system2(cmd0, args, env = env, stdout = outfile, stderr = outfile, :
error in running command
2: In utils::install.packages("ggh4x", repos = "https://cran.rstudio.com/") :
installation of package 'ggh4x' had non-zero exit status
Very strange!
Two conflict messages:
Package 'ggh4x' successfully installed.
installation of package 'ggh4x' had non-zero exit status