Saturday, 12 August 2017

installation - Getting ArcPy to work with Anaconda?



I am trying to follow the step-by-step directions in the answer to "how to separate Python installation with ArcGIS" but cannot find the path file, DTBGGP64.pth, in C:\Python27\ArcGIS10.2\Lib\site-packages.


Has someone has faced a similar issue?


I am wondering if there is a workaround by including a path file that tells Anaconda where arcpy is installed? I tried to create a .pth file containing the following text:


# .pth file for arcpy

C:\Program Files (x86)\ArcGIS\Desktop10.2\bin
C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.2\Scripts

and saved it to C:\Anaconda\Lib\site-packages (that is, if this is indeed where all the packages are saved) but I get the following error:



Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 21, in
from arcpy.geoprocessing import gp
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\__init__.py", line 14, in
from _base import *
File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 14, in
import arcgisscripting
ImportError: DLL load failed: %1 is not a valid Win32 application.


I am running conda 3.7-py27 on a windows 7 (64bit) platform. Anaconda is installed in C:\Anaconda and ArcMap is installed in C:\ArcGIS\Desktop10.2. Is there an alternative solution to get arcpy to work with Anaconda? I just want to be able to run my scripts from Powershell.



Answer



You're using a 64 bit version of Python in your Anaconda installation and ArcMap's Python is 32 bit. You'll need to install some 64 bit ArcGIS build (either 64 bit Background Geoprocessing or ArcGIS for Server) and point to that instead, or install a 32 bit Anaconda instance instead and try again. See the downloads page and get the 32 bit installer.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...