R-ArcGIS / r-bridge-install

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

R Integration.pyt displays as broken (x) #14

Closed rbjork closed 8 years ago

rbjork commented 8 years ago

I downloaded bridge(as zip), extracted and connect to the parent folder with ArcGIS Catalog. The "R Integration.pyt" show red X and does not expand to reveal install scripts. Opening the items description in the context menu(right mouse down on pyt) results in "The item's XML contains errors." I'm running with a trial version of ArcGIS 10.3.1 on Windows 8. R 3.2.3 is installed. Ron

scw commented 8 years ago

Hello Ron,

Could you try downloading the bridge again and see if you can reproduce the error? If so, could you post a screenshot so I can see the context? I haven't been able to reproduce this locally so far.

Cheers, Shaun

MonicaPalaseanu commented 8 years ago

Hi,

I have the same problem as Ron. If i open ArcGIS 10.3.1 (i have a full license on it - Enterprise DoI - USGS) as a normal user i can see the "R Integration.pyt" tool with its scripts with no problem but i cannot install anything because i don't have admin rights. If i open ArcGIS as an administrator the tool has the red X on it and i cannot expand or install anything. I will try to see if i can install somehow else, but any resolution would be very much appreciated. The system i am working on has Windows 7 professional and R 3.2.4 Revised. Thanks, Monica

MonicaPalaseanu commented 8 years ago

Hi,

Here it is a screen capture of the error. Thanks, Monica screen_01

scw commented 8 years ago

Hi @MonicaPalaseanu thanks for the report, and sorry to hear that the toolbox isn't working correctly for you. From the administrator account, could you right click on the toolbox, select 'Check Syntax' and send on a screenshot of the resulting message?

Thanks, Shaun

MonicaPalaseanu commented 8 years ago

Hi Shaun,

Thanks for looking into this. I hope we can solve the problem since i have lots of projects in whcih i am using R and it will be great if i can have a direct link between ArcGIS and R, instead of doing the usual export / import / export or data.

Here it is the screen shot you are requesting. Thanks, Monica screen_02

scw commented 8 years ago

Thanks Monica, that's very helpful. I think I might know the nature of the issue, and am working on creating a reproducible case. In the meantime, could you see if the following will work for you? Stay logged in as your current user, but open ArcMap or ArcCatalog by right clicking on its icon from the start menu, and select 'Run as Administrator'. Then try following the rest of the installation steps.

What I think is happening is that R is set up on a per-user basis, and when you switch to the Administrator account, it doesn't show up as being installed when I query the registry. I'm looking into a fix, and at a minimum letting the tool run but notifying the user how to rectify the problem.

Look forward to hearing about how you use the bridge!

Cheers, Shaun

MonicaPalaseanu commented 8 years ago

Hi Shaun,

Thanks for taking a look at this. Probably you are right about the R installation, i don't remember being asked for the admin password to do it. But i did sign in as a normal user and i run ArcGIS with "run as admin" from the start menu when the tool looked broken. Maybe i should do the reverse and sign from the beginning as an admin, see if R is available to me, and try to install the bridge that way.

I will let you know what is the outcome of that.

Thanks, Monica

MonicaPalaseanu commented 8 years ago

Hi again,

I think I know what's happening. You can install R without admin rights, so I did it when I updated my R install. With this setup that means R was not available when I was signing in as admin. ArcGIS was installed with admin rights (it cannot be done otherwise). So I guess the tool somehow could not "see" my R install. I signed as an admin directly on the system (we suppose to not really do that - though) and I re-installed R, and I run again ArcGIS as an admin (I had to, even if I was signed form the beginning on the system as an admin - don't ask me why - I have no idea but otherwise ArcGIS will still not install anything) and .... BINGO - it did work.

Now of course I have to deal with two R installs, so I really need to uninstall the first version of R.

Maybe if you cannot reproduce this issue, just write a big warning that R needs to be available to both admin and normal user privileges, as ArcGIS is in setups like mine. This at least will help others to avoid delays.

Thank you so much for all your help, Monica

MonicaPalaseanu commented 8 years ago

Hi Shaun,

More updates, if you are not sick of them by now. After installing the R bridge, i also discovered that i cannot run the example R scripts if i open the example mxd ArcGIS as a normal user. I get an error saying that no R is installed (which is it). But if i open the example mxd as an admin, then the tool works nicely. I can open or "see" R itself now as a normal user or admin without problem. So it seems to me that i cannot use the bridge or anything else without being an admin. This might be a problem in setups like ours where we are not really allowed to run anything as admin unless we install / uninstall something. Also not everybody has admin rights, and it is not trivial to get them in our organization. I have colleagues using R and ArcGIS without having admin rights. They will not be able to use the R-bridge if it works only with admin rights.

I know this is more IT stuff and security than R or ArcGIS, but i am wondering if this issue can be solved.

Thanks again, Monica

scw commented 8 years ago

Hi Monica,

Thanks for your further investigations, very helpful. I see how the issue comes up, and it's a use case that we'd like to support. I've updated the code to try a new approach, which basically looks into the users' registry even when 'Run as Administrator' is in effect for an R installation. This should allow it to find your local user R installation and wire up the bridge, without having to install or run as administrator. Could you try removing your admin version of R, and see if the tool now correctly detects the local-only copy?

Cheers, Shaun

MonicaPalaseanu commented 8 years ago

Hi Shaun,

Thanks for working on this. To be honest i am a little wary in uninstalling my current version of R since i finally configured as i wanted it with over 100 external packages i usually use or i am curious about. Installing R itself is not a big deal, but adding all that external packages takes time as you know. Is there any way to keep both installs and somehow look only for the local R installation? Even if the installation of the R bridge requires both ArcGIS and R to be admin installed, it will be great if afterwards somebody can actually use the bridge running ArcGIS as normal user. I think this is the most important part, since others who don't have admin rights can ask IT to install everything they need (hopefully) and after just use the tool as normal users. Just a thought.

Thanks, Monica

scw commented 8 years ago

Hi Monica,

I agree, uninstalling and reinstalling R can be daunting because of the packages. If you're reinstalling within the same version, you can pretty easily back up your existing packages between installations, and removing the software won't uninstall packages that you've added. To back up the packages, copy the directory located here for a local install:

%USERPROFILE%\Documents\R\win-library

Inside that directory, you should find a directory corresponding to the {major.minor} version of R. So for R 3.2.4, it should have a '3.2' directory.

For the global installation of R, it should register its packages into the program files for R. So following the example above, installed packages will end up in:

%PROGRAMFILES%\R\R-3.2.4\library

The issue with admin privileges and the R bridge is due to a bug that exists in 10.3.1 -- at 10.4, we've fixed it as an issue. The overall challenge is ArcGIS has to decide which R to talk to -- there can be multiple installs on the machine. By default, it chooses the most recently installed one. If you want to manually force ArcGIS to link to a specific version, you can do so by using a command prompt. I've laid out the steps to do so below:

  1. First, you'll need to find out the path to the arcgisbinding package as installed in your users' R package library. In the example above, this is %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding. Copy that path.
  2. Open an elevated Command Prompt window, by right clicking on cmd.exe and selecting 'Run as Administrator'.
  3. Navigate to the ArcGIS Installation directory. For 10.3.1, typically that would be C:\Program Files (x86)\ArcGIS\Desktop10.3, so: cd C:\Program Files (x86)\ArcGIS\Desktop10.3
  4. Create a new directory here called 'Rintegration', and switch to it: mkdir Rintegration cd Rintegration
  5. Make a link between the installed location of the package in R, and this location. This is there we use the value of the location we found in step one. The command looks like: mklink /J <src> <dest>. So here, it would be: mklink /J %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding .\arcgisbinding

Try out R from ArcGIS. You can run the "R Installation Details" script and see if it reports a connection with R successfully.

mjanikas commented 8 years ago

Just an FYI… I have had to reinstall R so many times that I just went ahead and made a list of all the packages I require and put them in a txt file delimited by newline. Then every time I reinstall I just open up R and source this code:

p = read.table("addRLibraries.txt") pv = as.vector(p$V1) install.packages(pv)

Every time I install a new package I add it to the text file… then it doesn’t matter if the version changes. Along the same line… I have had issues with older library folders sticking around after uninstall and then messing up the newer installation. I always make sure the core R directory in Program Files is deleted after I uninstall.

MJ

From: Shaun Walbridge [mailto:notifications@github.com] Sent: Friday, March 25, 2016 6:11 PM To: R-ArcGIS/r-bridge-install Subject: Re: [r-bridge-install] R Integration.pyt displays as broken (x) (#14)

Hi Monica,

I agree, uninstalling and reinstalling R can be daunting because of the packages. If you're reinstalling within the same version, you can pretty easily back up your existing packages between installations, and removing the software won't uninstall packages that you've added. To back up the packages, copy the directory located here for a local install:

%USERPROFILE%\Documents\R\win-library

Inside that directory, you should find a directory corresponding to the {major.minor} version of R. So for R 3.2.4, it should have a '3.2' directory.

For the global installation of R, it should register its packages into the program files for R. So following the example above, installed packages will end up in:

%PROGRAMFILES%\R\R-3.2.4\library

The issue with admin privileges and the R bridge is due to a bug that exists in 10.3.1 -- at 10.4, we've fixed it as an issue. The overall challenge is ArcGIS has to decide which R to talk to -- there can be multiple installs on the machine. By default, it chooses the most recently installed one. If you want to manually force ArcGIS to link to a specific version, you can do so by using a command prompt. I've laid out the steps to do so below:

  1. First, you'll need to find out the path to the arcgisbinding package as installed in your users' R package library. In the example above, this is %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding. Copy that path.
  2. Open an elevated Command Prompt window, by right clicking on cmd.exe and selecting 'Run as Administrator'.
  3. Navigate to the ArcGIS Installation directory. For 10.3.1, typically that would be C:\Program Files (x86)\ArcGIS\Desktop10.3, so: cd C:\Program Files (x86)\ArcGIS\Desktop10.3
  4. Create a new directory here called 'Rintegration', and switch to it: mkdir Rintegration cd Rintegration
  5. Make a link between the installed location of the package in R, and this location. This is there we use the value of the location we found in step one. The command looks like: mklink /J . So here, it would be: mklink /J %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding .\arcgisbinding

Try out R from ArcGIS. You can run the "R Installation Details" script and see if it reports a connection with R successfully.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_R-2DArcGIS_r-2Dbridge-2Dinstall_issues_14-23issuecomment-2D201639459&d=CwMCaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=NvzNTdPvS7Y1JqqzmEYoNfO6Ri7tbIFouSA87abLwtE&m=C_ru6_GBotE9_l0sXW1VvbrAX1Kogt-PcM27U0FqmPs&s=sL2FIEjG1nHLF6UQQp0ExfAFx3vFmhXSaH5gCaKOLwc&e=

MonicaPalaseanu commented 8 years ago

Hi, Thanks so much for the suggestions. I am swamped in a project now, but immediately i have a sec. i will try it. I am very excited actually about this new ArcGIS - R bridge and after i figure out everything i hope to present a short talk in my dept. since quite few of us actually use R and ArcGIS in our daily work. Thanks,Monica

Date: Sat, 26 Mar 2016 22:16:06 -0700 From: notifications@github.com To: r-bridge-install@noreply.github.com CC: ab33_n0rm41@hotmail.com Subject: Re: [r-bridge-install] R Integration.pyt displays as broken (x) (#14)

Just an FYI… I have had to reinstall R so many times that I just went ahead and made a list of all the packages I require and put them in a txt file delimited by newline. Then every time I reinstall I just open up R and source this code:

p = read.table("addRLibraries.txt")

pv = as.vector(p$V1)

install.packages(pv)

Every time I install a new package I add it to the text file… then it doesn’t matter if the version changes. Along the same line… I have had issues with older library folders sticking around after uninstall and then messing up the newer installation. I always make sure the core R directory in Program Files is deleted after I uninstall.

MJ

From: Shaun Walbridge [mailto:notifications@github.com]

Sent: Friday, March 25, 2016 6:11 PM

To: R-ArcGIS/r-bridge-install

Subject: Re: [r-bridge-install] R Integration.pyt displays as broken (x) (#14)

Hi Monica,

I agree, uninstalling and reinstalling R can be daunting because of the packages. If you're reinstalling within the same version, you can pretty easily back up your existing packages between installations, and removing the software won't uninstall packages that you've added. To back up the packages, copy the directory located here for a local install:

%USERPROFILE%\Documents\R\win-library

Inside that directory, you should find a directory corresponding to the {major.minor} version of R. So for R 3.2.4, it should have a '3.2' directory.

For the global installation of R, it should register its packages into the program files for R. So following the example above, installed packages will end up in:

%PROGRAMFILES%\R\R-3.2.4\library

The issue with admin privileges and the R bridge is due to a bug that exists in 10.3.1 -- at 10.4, we've fixed it as an issue. The overall challenge is ArcGIS has to decide which R to talk to -- there can be multiple installs on the machine. By default, it chooses the most recently installed one. If you want to manually force ArcGIS to link to a specific version, you can do so by using a command prompt. I've laid out the steps to do so below:

  1. First, you'll need to find out the path to the arcgisbinding package as installed in your users' R package library. In the example above, this is %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding. Copy that path.
  2. Open an elevated Command Prompt window, by right clicking on cmd.exe and selecting 'Run as Administrator'.
  3. Navigate to the ArcGIS Installation directory. For 10.3.1, typically that would be C:\Program Files (x86)\ArcGIS\Desktop10.3, so: cd C:\Program Files (x86)\ArcGIS\Desktop10.3
  4. Create a new directory here called 'Rintegration', and switch to it: mkdir Rintegration cd Rintegration
  5. Make a link between the installed location of the package in R, and this location. This is there we use the value of the location we found in step one. The command looks like: mklink /J . So here, it would be: mklink /J %USERPROFILE%\Documents\R\win-library\3.2\arcgisbinding .\arcgisbinding

Try out R from ArcGIS. You can run the "R Installation Details" script and see if it reports a connection with R successfully.

You are receiving this because you are subscribed to this thread.

Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_R-2DArcGIS_r-2Dbridge-2Dinstall_issues_14-23issuecomment-2D201639459&d=CwMCaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=NvzNTdPvS7Y1JqqzmEYoNfO6Ri7tbIFouSA87abLwtE&m=C_ru6_GBotE9_l0sXW1VvbrAX1Kogt-PcM27U0FqmPs&s=sL2FIEjG1nHLF6UQQp0ExfAFx3vFmhXSaH5gCaKOLwc&e=

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

scw commented 8 years ago

@MonicaPalaseanu No problem, we can revisit this issue once you have time. When you do, let us know if the updated toolbox fixes your issue, or if there's anything else you need to support your use-case.

Great that you might present this to your colleagues. We've been working with Cam Plouffe at Esri Canada who recently gave a two-part webinar on using the bridge that may also be of interest. The first part is up on YouTube now.

Cheers, Shaun

scw commented 8 years ago

Haven't heard back from @rbjork or @MonicaPalaseanu on the installation issue, and there have been many updates to the package in the interim. Closing this, but new issues are welcome if specific problems are occurring.