Installation dependency present, but not found.

What are some reasons an installed package won't be found by a call to loadNamespace() ?

tl;dr The installing processx cannot find ps package, even though ps package is installed.

Install ps package

I'm Installing processx as a dependency to roxygen2. Installing processx failed claiming package ps was not found. To remedy, installed ps manually.

install.packages("ps")

installing via 'install.libs.R' to /home/grosscol/R/x86_64-pc-linux-gnu-library/3.5/ps
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

  • DONE (ps)

## Check ps package installation
Restart the R session, and check. Installation of ps appears to have worked.
```r
> packageVersion("ps")
# [1] ‘1.1.0’
ps::ps_boot_time()
# [1] "2018-10-15 12:50:17 GMT"

Error installing processx package persists

Go to retry processx installation, and it fails again with the same error message.

install.packages("processx")
installing via 'install.libs.R' to /home/grosscol/R/x86_64-pc-linux-gnu-library/3.5/processx
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘processx’:
 .onLoad failed in loadNamespace() for 'processx', details:
  call: loadNamespace(name)
  error: there is no package called ‘ps’
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/grosscol/R/x86_64-pc-linux-gnu-library/3.5/processx’
Warning in install.packages :
  installation of package ‘processx’ had non-zero exit status

Where to check for problems?

I don't know where else to look for the source of this problem as .libPaths() appears to be correct.

> .libPaths()
# [1] "/home/grosscol/R/x86_64-pc-linux-gnu-library/3.5" "/usr/local/lib/R/site-library"                   
# [3] "/usr/lib/R/site-library"                          "/usr/lib/R/librar

Any suggestions for a different angle to poke at this? Or another location to check in an R-3.5.1 installation on Ubuntu bionic (x86_64-pc-linux-gnu)?

I was able to run the same command successfully from the command line R CMD --vanilla.

This runs on the command line, but not from RStudio:

install.packages("processx")

Does it work from command-line R without the vanilla flag?

Are you now able to load processx successfully from RStudio?

2 Likes

It does not work without the vanilla flag. Excellent suggestion.
It does not work in RStudio after it successfully runs from the R --vanilla prompt.

Does that imply the problem is in an environment, site, or profile file somewhere?

1 Like

Thank you very much! My .Rprofile had a bad path as an argument to .libPaths(). Your inquiry narrowed it right down to where the problem was located.

1 Like