Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

wrong windows PATH in R

Frank
2013-09-27
2013-10-26
  • Frank
    Frank
    2013-09-27

    I just spent almost a day figuring out why Rcpp was failing to find its cpp compiler. It turns out that when I open up an R session normally, my path starts with 'c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;' as it should, but when I spawn a session with nppToR, these first two items are missing. Weird, right?

    Fortunately, I came across the

    Sys.setenv("PATH"=paste('c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;',Sys.getenv("PATH"),sep=''))

    command in R and rtools politely tells me what the entire path should be during installation, too.

    Anyway, I guess this could be a bug in nppToR? Like I said, I have a workaround, so it's not a problem for me right now.

    Thanks,

    --Frank

     
  • Andrew Redd
    Andrew Redd
    2013-09-27

    Did this occur right after installing or upgrading the Rtools? if so NppToR must be re-launched. I don't believe that NppToR sets the path however it might have inherited an old version of the path, and R would inherit it from NppToR as windows copies environment variables and programs, and spawned programs only see the variables that were defined at the time of starting.

     
  • Frank
    Frank
    2013-10-26

    Nope, it wasn't immediately after upgrading Rtools. I have restarted the system since and whenever I forget to set the path, my rcpp code returns an error instead of compiling. I just checked Sys.getenv('PATH') to confirm that they are not there.

    Thanks for a great tool!