3

I have got a lot troubles with GDAL and OGR in the context of ArcGIS Server on 64 bit server machine. I can run script that use GDAL in ArcGIS as Tool and in the debug mode in PyScripter, then publish script as GP Service. I know that ArcGIS for Dekstop use 32 bit version of Python, and Server use 64 bit. I can see both version in Python27 folder. So in the desktop mode (32 bit) everything is Ok. But when I use submit job by REST I get an ERROR

esriJobMessageTypeError: Traceback (most recent call last): File "C:\arcgisserver\directories\arcgissystem\arcgisinput\project\Analize.GPServer\extracted\v101\Analize.py", line 14, in from osgeo import gdal File "C:\Python27\ArcGISx6410.1\lib\site-packages\osgeo__init__.py", line 21, in _gdal = swig_import_helper() File "C:\Python27\ArcGISx6410.1\lib\site-packages\osgeo__init__.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) ImportError: DLL load failed: Nie można odnaleźć określonego modułu.

I know that the reason is GDAL library. How to configure environment on ArcGIS Server machine to force to use 32 bit GDAL in the case of ArcGIS for Desktop and 64 bit for ArcGIS Server?

I installed: GDAL for Desktop 32 bit according this solution How to run OGR in ArcGIS Scripts? GDAL for ArcGIS 64 bit the same packages but for 64 bit

When I change PATH to new GDAL 64 bit script in ArcGIS and Service does not work

If PATH is set to GDAL 32 bit script works, but I still get error by REST. It seems that ArcGIS Server does not see the GDAL library on the server machine.

2 Answers 2

2

I don't have any personal experience with GDAL. But I can tell you you need 64bit versions of Python packages with 64bit GP Services.

Have you installed 64bit GDAL? Try this from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal (I believe he provides 64bit Python packages as a use-at-your-own-risk)

1

I have already found the solution: First of all at the beginning of my script I changed my PATH according to environment (Desktop or Server). In this way script will be use proper version of GDAL

if 'ArcGIS10.1' in str(os.path): path = r'C:\Program Files (x86)\GDAL'

if 'ArcGISx6410.1' in str(os.path): path = r'C:\Program Files\GDAL'

os.environ["PATH"] += os.pathsep + path

Then I added two Data Stores by ArcGIS Server Manager with location of GDAL 32 bit and GDAL 64 bit. After publishing I can run this script in ArcGIS for Desktop and also by REST as service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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