5

I used Eclipse with PyDev to create a script in Python (windows 7 x64). My code runs perfect when I start the run in Eclipse, but when I add it as a Tool in ArcGIS 10.1, I have the following problems:

If I select ‘run python script in progress’ (which I know I shouldn’t do): enter image description here

If I don’t select ‘run python script in progress’, there are two possibilities:

1) Eclipse is closed when I start the run: ArcGIS automatically opens Eclipse, and the script seems to run, but doesn’t do anything, this windows stays open until I cancel the run: enter image description here

2) If eclipse is opened before I start the run, it seems as if the run is completed within 0.00 seconds, but the script was not executed…: enter image description here

My configuration in eclipse is as follows (anaconda python + paths for functionalities arcgis): enter image description here

I run the tool in ArcGIS without any parameters, so the code is exactly the same as the code that I run from Eclipse… I already tried this solution, but it doesn’t seem to work for me:

  • The problem is likely that you are mixing the Python from python.org (in C:\Python27) and the Anaconda Python (in C:\Anaconda). – asmeurer Jan 22 '15 at 23:06
  • Thank you for the reaction, any idea how I could avoid mixing the two versions? I tried this but it doesn't seem to work... – Mattias Feb 5 '15 at 15:58
  • @Mattias Are you using the 32 bit or 64 bit version of Anaconda Python? – papadoo May 15 '15 at 15:53
1

You can move the ArcPy directory into the Anaconda folder. Make sure you are using the 32-bit version of Anaconda before you do this.

Go into the root folder for the ArcGIS python:

C:\Python27\ArcGIS10.4\Lib\site-packages

then look for a file named Desktop 10.4.pth If you are using a different version of Arc it will read 10.x instead of 10.4 which is what I am currently using.

You want to copy that file. MAKE SURE YOU COPY IT. If that file leaves where it is located you will have issues. Paste the copied file into the site-packages folder for anaconda:

C:\Users\(CurrentProfile)\AppData\Local\Continuum\Anaconda2 (or Anaconda if using version1)\Lib\site-packages

Once pasted in there restart Anaconda and you should be all set up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.