Error installing any package

Trying to install any package i get the following error:

/usr/lib/R/bin/R: line 8: uname: command not found
/usr/lib/R/bin/R: line 143: exec: sh: not found

I am on Ubuntu 18.04 with R 3.6.2
I have tried within Rstudio and console R.
I have un/reinstalled R. Installed from source.
I haven't used R in a while so not sure what has changed. All my system packages are up to date.
Uname is installed (lcoation /bin which is on path)

Hi, and welcome!

First, confirm that uname is installed

$ which uname
/usr/bin/uname

If it is, make sure /usr/bin is in your $PATH

Yes uname is installed. Located in /bin, which is in my path.

/usr/bin needs to be in your $PATH

That is also in my path.

Is it in the $PATH of the user that is running R? For example, root?

Path of user contains:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

And default secure_path for sudo, from /etc/sudoers:

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

I've checked that I'm not destroying the path in .bashrc by a bad PATH export command as well. I can call regular uname, as well as sudo uname from console without error.

Well, that's passing strange. I could see that RStudio might somehow have been installed as a different user, but R in console, of course, invokes with the terminal session user.

Can we try comparing sessionInfo()?

Yea I am struggling with this one. This is my personal machine, I am the only user and do everything from this user account. I upgraded to 18.04 from 16.04 a few months ago. Installed R, Rstudio, and was able to install packages at one time. I must have installed some other software that wonked this out. Really hoping I don't have to wipe the os just so I can get R working right again.

From RStudio:

R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.6.2 parallel_3.6.2 tools_3.6.2

From console:

R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2

OK, here's my RStudio (sessionInfo() doesn't play nicely with reprex

sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Pop!_OS 19.10
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_3.6.1  magrittr_1.5    tools_3.6.1     htmltools_0.4.0
#>  [5] yaml_2.2.0      Rcpp_1.0.3      stringi_1.4.4   rmarkdown_2.0  
#>  [9] highr_0.8       knitr_1.26      stringr_1.4.0   xfun_0.11      
#> [13] digest_0.6.23   rlang_0.4.2     evaluate_0.14

and the console

sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Pop!_OS 19.10
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_3.6.1  magrittr_1.5    tools_3.6.1     htmltools_0.4.0
#>  [5] yaml_2.2.0      Rcpp_1.0.3      stringi_1.4.4   rmarkdown_2.0  
#>  [9] highr_0.8       knitr_1.26      stringr_1.4.0   xfun_0.11      
#> [13] digest_0.6.23   rlang_0.4.2     evaluate_0.14

(POP_OS is Ubuntu in party attire.)

You're a point release behind me on BLAS and LAPACK, I don't have the RNG. You have fewer namespace attached packages. (These were both fresh sessions.)

My R Console has fewer attached packages than yours.

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 19.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1

There's really nothing that pops out as an obvious problem. Do you see anything?

Oh, and here's my $PATH

$PATH
/home/roc/.local/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/opt/ruby/bin:/usr/local/lib://home/roc/go/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/roc/bin

No sessionInfos look pretty close.

I have found the line in install.packages that it crashes on. When calling system2(com0)

If i run

system2("exec uname")

I get the same error.

I have noticed an additional clue? When I quit R at the console (q()) and respond no to save workspace i get the following error:

sh: 1: rm: not found

I found it. For some reason I had a .Renvironment file in my home directory that clobbered my path. Not sure why I did that.

I appreciate you taking the time to troubleshoot.

2 Likes

Mystery solved. It had to be a $PATH issue! Please mark your answer as the solution for those who follow.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.