[Qgis-user] help manageR to find the path.......

Carson Farmer carson.farmer at gmail.com
Sun May 24 07:46:45 PDT 2009


Hi Darren,
> Just installed manageR (0.6.10) on Windows Vista.
> Qgis 1.0.2-Kore installed via standalone installer, R version is 2.9.
> ManageR installed via the python plugin installer, following Carson's 
> guide at: http://www.ftools.ca/install.html
>
> Got a python error (below) and it looks like manageR can't find R.
> This is not too surprising as I set HOME, R_USER etc via a 
> Renviron.site file.
> So R is not in the registry and no environment variables are set.
>
> How do I show manageR where the R.exe file is??
In this case you'll have to set an environment variable I think.

The error that you posted comes up when the following fails:

 try:
     R_HOME = os.environ["R_HOME"]
 except KeyError:
     R_HOME = os.popen("R RHOME").readlines()
 if len(R_HOME) == 0:
     if sys.platform == 'win32':
         try:
             import win32api
             import win32con
             hkey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
                                          "Software\\R-core\\R",
                                          0, win32con.KEY_QUERY_VALUE )
             R_HOME = win32api.RegQueryValueEx(hkey, "InstallPath")[0]
             win32api.RegCloseKey( hkey )
         except:
             raise RuntimeError(
                 "Unable to determine R version from the registery." +\
                 "Calling the command 'R RHOME' does not return anything.\n" +\
                     "This might be because R.exe is nowhere in your Path.")


So obviously if R isn't in the registry, and there is no R_HOME 
environment variable, Rpy (which is what manageR uses to talk to R) 
won't be able to find R. Essentially, you just need to specify the 
R_HOME environment variable as your R install path.

The other option is to add something like:

import os
os.environ['R_HOME'] = "R/install/path"

to line 20 of either __init__.py or manageRDialog.py in the manageR 
plugin directory.

Hope that helps,

Carson



More information about the Qgis-user mailing list