Eric Archer - NOAA Federal
2014-Oct-24 21:54 UTC
"command not found" from system() call in GUI with proper PATH
<Apologies for the cross-posting, but I couldn't tell if this was a general R issue, or Mac-specific> When running a system file from within R, I have just started to get a "command not found" error although my PATH seems to be properly set and I can run the same system file from the terminal. The program I am trying to run is 'fastsimcoal' and is in /usr/local/bin. I confirm this in the terminal with SWC-EARCHER-ML-3:~ eric.archer$ which fastsimcoal /usr/local/bin/fastsimcoal In the examples below, Sys.getenv("PATH") shows that /usr/local/bin is in the PATH. I get the same error for any program in /usr/local/bin. However, programs in other folders in the path seem to run through system() properly. Also, note that the return from Sys.getenv("PATH") is the same for running in R-Studio vs. R in the terminal, but is truncated in the R GUI. As far as I can tell I do not have a .Rprofile file in my default working directory, R_HOME, or R_HOME/etc. A final piece of information: I have just upgraded to OSX Yosemite v10.10. This was not happening at some point prior to the upgrade, but it has been a while since I tried this particular command, so I do not know if it was working immediately prior to the OS upgrade. Any help or insight is greatly appreciated. Cheers, eric The examples:>From within R-Studio v0.98.1079:> sessionInfo()R version 3.1.1 (2014-07-10) Platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_3.1.1> getwd()[1] "/Users/eric.archer"> Sys.getenv("PATH")[1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin"> system("fastsimcoal")sh: fastsimcoal: command not found The same script in the R console through the GUI gives:> sessionInfo()R version 3.1.1 (2014-07-10) Platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base> getwd()[1] "/Users/eric.archer"> Sys.getenv("PATH")[1] "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"> system("fastsimcoal") >/bin/sh: fastsimcoal: command not found Running it through R in a terminal window, it runs (output of 'fastsimcoal' truncated):> sessionInfo()R version 3.1.1 (2014-07-10) Platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base> getwd()[1] "/Users/eric.archer"> Sys.getenv("PATH")[1] "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin"> system("fastsimcoal")fastSimcoal2 (ver 2.1 December 2013) Usage: -h --help : prints this help -i --ifile test.par : name of parameter file ... ---- *Eric Archer, Ph.D.* Southwest Fisheries Science Center NMFS, NOAA 8901 La Jolla Shores Drive La Jolla, CA 92037 USA 858-546-7121 (work) 858-546-7003 (FAX) Marine Mammal Genetics Group: swfsc.noaa.gov/mmtd-mmgenetics ETP Cetacean Assessment Program: swfsc.noaa.gov/mmtd-etp " *The universe doesn't care what you believe. The wonderful thing about science is that it doesn't ask for your faith, it just asks for your eyes.*" - Randall Munroe "*Lighthouses are more helpful than churches.*" - Benjamin Franklin "*...but I'll take a GPS over either one.*" - John C. "Craig" George [[alternative HTML version deleted]]