Closed wondie closed 3 years ago
arcgisbinding_1,0,0.128.zip
and install the package.C:\Users\<USERNAME>\AppData\Local\ESRI
. Create 'RIntergation.conf' file and and add one line: R_HOME=C:\Program Files\R\R-3.3.2 (adjust path if needed)
or execute this command line:
C:\> echo R_HOME=C:\Program Files\R\R-3.3.2 > %APPDATA%\..\Local\Esri\RIntergation.conf
Thank you very much for the help. Unfortunately, I couldn't run r scripts from my Python toolbox. I was using python subprocess.call() method to call some CMD commands calling and using r scripts. Is there a way of making this work? It works well in ArcGIS Desktop.
@wondie Could you share some details on how you're trying to execute R with the package? The two main deployment stories are:
Can you use either of these above patterns? If you do need to use subprocess calls, can you provide some details about what you're trying to do? If you just need to call R from Python, you should be able to make an R script tool, then execute it from Python by importing the toolbox and calling the tool as you would with any Python tool or ModelBuilder model. If you have other reasons to need subprocess calls, share a little more about what you're doing and we can take a look.
@scw what I am using is similar to the first option. I am happy to change subprocess.call() if there is a working alternative. This is how it is used in the toolbox.
r_cmd = '"' + r_exe_path + '" --vanilla --slave --file="' + ras_temp_path + 'out_script.r"' # r command
arcpy.AddMessage("Running similarity analysis \n")
# TODO Apply this change on desktop version
CREATE_NO_WINDOW = 0x08000000
# Open shell and run R command
subprocess.call(shlex.split(r_cmd), shell=False, creationflags=CREATE_NO_WINDOW)
The out_script.r contains the following command.
source("D:/mytool/R_Scripts/similarity_analysis.r");
similarityAnalysis(1,"D:/mytool/R_Scripts/readAscii.r","D:/mytool/R_Scripts/writeAscii.r","C:/Users/User/Documents/ArcGIS/scratch/Temp/")
The use of the R scripts is to create ASCII files for statistics Mahalanobis and Multivariate Environmental Similarity Surfaces (MESS).
The above approach works in Desktop but not in the server.
Is there anything wrong with my implementation?
@wondie I don't see anything immediately obvious. I'll need to stand up a Server instance and install R onto it to look, once I do so I'll let you know.
@scw thank you!
Could incompatibility of Python 64 bit (For server) and 32 bit for R be the cause of the problem?
Can anyone please comment on ArcGIS Server unable to locate R-Brigde? I have both desktop and server on the same machine. I can run R in desktop but publishing it as a GP service always bring "R Bridge not installed" from the AGS service log. Thanks!
@MichaelGGeoda Do you run Server as a different user than your personal user account? You will need to have a Rintergation.conf
file in %LOCALAPPDATA%\ESRI
for the Server user as well for it to find R, with the value of R_HOME set as @dpavlushko described above.
@MichaelGGeoda, it is also worth taking a look at the enterprise documentation for arcgisbinding
Closing this issue, the above documentation can be referenced for future folks trying to install on Server.
I wanted to use this tool because R console couldn't run when called from Python Geoprocessing tool.