R-ArcGIS / r-bridge-install

Install the R ArcGIS Tools
Apache License 2.0
188 stars 59 forks source link

Error: Failed to initialize R interpreter #73

Open imagesbyjohnyoung opened 6 years ago

imagesbyjohnyoung commented 6 years ago

Have installed R Bindings, R 3.4.2 i386 ArcGis 10.4.0.5524 Advanced Licence Testing the R Sample Tools. I load the Model Based Clustering .mxd and run tool error shown in attached file. Error: Failed to initialize R interpreter

Required admin rights for install, but as everyday user on corporate system no admin rights to run arcgis. It appears you may need admin rights to right to folder/registries?

error

scw commented 6 years ago

@imagesbyjohnyoung Hello, could you report the output of the R Installation Details tool? Can you run these two commands from a 32-bit RGui session and what they respond with?

library(arcgisbinding)
arc.check_product()
imagesbyjohnyoung commented 6 years ago

image

If I run a simply script from arc (not as administrator) image

Now if I run arcgis as administrator - partly works The issue is very limited people in the dept have admin rights, hence cannot run as admin due to government rules etc.

image

When I run direct from R - works image

Testing the Model Based Clustering as administrator image

scw commented 6 years ago

@imagesbyjohnyoung Thanks for the further sleuthing on your part, that's helpful. Could you also run the "R Installation Details" tool in the bridge installer toolbox and share what it reports? R has many environmental variables it responds to, and I'm hoping the output from that tool will show us how R is configured.

imagesbyjohnyoung commented 6 years ago

@scw Re the c:\Program Files Folder.. we do not have write access to these unless logged in as administrator. im currently logged in as administrator to be able to even run these tools/

The real issue is that if you don't have admin rights, the everyday user cannot access. general security rights as a normal user image

image

Unable to access if not logged in as administrator: image

scw commented 6 years ago

@imagesbyjohnyoung OK, it looks like the machine is configured without an R_LIB_USER value set. Can you try manually creating the directory %userprofile%\Documents\R\win-library\3.5? That should allow you to manage R packages on a per-user basis and avoid issues with requiring privilege escalation in order to install packages. For the lack of access to the Python toolbox, can you right click on it and select "Show error" or "Check Syntax" if either of those is provided? I haven't seen this particular issue when testing on an account without administrative rights before.

imagesbyjohnyoung commented 6 years ago

@scw %userprofile%\Documents\R\win-library\3.5 is already in exists

R_LIB_USER value set, assumption this is referring to sys. enviro settings? what should this be set as

From Check Syntax (when not running as admin) image

From Check Syntax (when running as admin) image

scw commented 6 years ago

OK, thanks for the further details. For the Python issue, it looks like Anaconda has been installed, and registered as the global Python 2 interpreter. This will break anything with ArcGIS that uses Python or Geoprocessing, which rely on the Python installation that ships with ArcGIS. I recommend you repair the installation for Desktop prior to trying any other debugging of in-application usage of the bridge.

It's probably the case that the association with the Python interpreter is set on the user account, and running as administrator circumvents this by using the registry keys associated with the administrator, and ignoring the HKCU hive associated with the user account.

imagesbyjohnyoung commented 6 years ago

@scw Re running python from ArcGIS, no issues at all. I've written many geo-processing scripts in python for ArcGIS.

This is the first time I have come across this issue.

We use the anaconda for a variety of python tools. Will do some research on the Anaconda install.

imagesbyjohnyoung commented 6 years ago

@scw With a bit of research re the error it appears there is a conflict between a 32bit and 64bit version of one of the libraries. Running a 64bit anaconda, this appears to be playing up with the 32bit py libs for this particular program.

So trying to resolve how to run both Anaconda as 32bit and 64bit. interesting

scw commented 6 years ago

@imagesbyjohnyoung If you can, I'd recommend uninstalling Anaconda, and reinstalling it without adding it to the PATH or registering it as the global Python interpreter. Having a global Python interpreter is nice (you can access it from the command prompt; you know exactly what a double click action on a .py file will do), but it causes problems when you have multiple pieces of software that need to work with Python, sometimes with conflicting dependencies. For ArcGIS Pro, we ship Anaconda (miniconda) and do extra work to isolate the installation from the rest of the machine, but on 10.x there's a little bit of work to make sure there's no cross-talk between environments. If you do need to say, access ArcPy from your Anaconda installation of Python, you can follow the instructions Curtis Price of USGS has helpfully put together.

imagesbyjohnyoung commented 6 years ago

@scw I have uninstalled and reinstalled 32bit version. Following the steps outlined in the instructions Curtis Price. It references a .cer file to download that is required to be used.

This is no longer available ??

image

scw commented 6 years ago

@imagesbyjohnyoung I think that particular step may only apply to USGS / DOI employees -- try it without and see if it works for you. Optionally, if you do have some kind of SSL configuration which isn't directly understood by conda, you can use conda config --set ssl_verify false. Note that this effectively disables certificate checking for conda, but it can be useful in some environments where there are certificates not part of the global chain of trust that most browsers and clients use.

imagesbyjohnyoung commented 6 years ago

@scw In configure of Arcgis python to anaconda enviro and vice versa

As we dont have either arcmap64 or arcpro installed. do we leave these as blank?

Anaconda home folders

conda_arcmap_home = r"C:\Users\youngja\AppData\Local\Continuum\anaconda2" conda_arcmap64_home = r"" conda_arcpro_home = r""

anaconda environments set up to match Desktop and Pro

conda_arcmap_env = "arc1041" conda_arcmap64_env = "" conda_arcpro_env = ""

ArcGIS Pro install folder

default_pro_path = r""

change to false after testing done

debug = True

imagesbyjohnyoung commented 6 years ago

@scw I left the conda_arcmap64_home / conda_arcpro_home as ""

Appears i have all this working to this point. Now to recheck the r bridge info

image

imagesbyjohnyoung commented 6 years ago

@scw - After conda reinstall:

ARCGIS loaded as normal user (no admin rights)

No cross on .pyt toolbox image

Check syntax image

Wanted to test if could run update bindings with NO Admin Rights image

Run model based clustering (No Admin Rights) - Doesnt work

image

Run as Admin User - Works

image

gstszhouxj commented 2 years ago

how do you solved?

gstszhouxj commented 2 years ago

how to Run model based clustering (as Admin Rights), thanks