3

I am developing a Python Toolbox that uses a few external libraries (ogr/gdal, matplotlib, shapely, reportlab among others) which files I have directly copied in the same folder as my toolbox .py, as recommended in Esri's A simple approach for including 3rd party Python libraries with your scripts. It works just fine on my computer, but when I run this tool on another computer, I get an ImportError. It's very likely that the libraries are the reason for that error.

<type 'exceptions.ImportError'>: DLL load failed: The specified procedure could not be found.

Moreover, I don't get the ImportError the same way from ArcGIS10.0 or ArcGIS10.1 (10.0: only get the error without any additional message; 10.1: get the error where it worked fine in the previous version), which worries me a bit because this really looks like a singular configuration dependent problem.

How do I find the missing dependencies in my current distribution and ensure that the tool which I distribute will work on every computer with a fresh ArcGIS installation?

I have tried what I consider the usual ways to solve that problem:

1 Answer 1

3

I don't think this is a matter of missing dependencies, it's a matter of incorrectly versioned dependencies. ArcGIS 10.0 runs Python 2.6, while 10.1 runs 2.7. Any library with a C extension will need to be bundled with your toolbox for the correct version of Python depending on the target version of ArcGIS.

5
  • Thanks, that's probably what explains the differences between the 2 versions. It makes me wonder something else: will the error be the same for a missing library and for an incorrectly versioned one? I will explore that. However I still have this ImportError occurring on other computers but not on mine (with the same version).
    – 7hibault
    Jul 2, 2014 at 13:07
  • You'll get the same error type (ImportError) but the error message will be different. Jul 2, 2014 at 13:12
  • Alright, that answers one problem. Do you have any additional insights on the missing libraries (or else if I'm wrong) issue?
    – 7hibault
    Jul 2, 2014 at 14:42
  • In your script tools, you may need to add the directory of the current script to sys.path so Python can find your bundled copies. Jul 2, 2014 at 15:09
  • Thanks for the suggestion but unfortunately it did not work (it didn't change the outcome at all)...
    – 7hibault
    Jul 8, 2014 at 12:05

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.