6

I am running python 2.7.6 from an ArcGIS installation. I have tried to install scipy from the Python Exchange Packages here, using the scipy-0.14.0.win32-py2.7.exe executable. I get no error importing scipy, but when I try to import scipy.spatial I get the following error:

In [1]: import scipy

In [2]: import scipy.spatial
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-6f8fbf892cc9> in <module>()
----> 1 import scipy.spatial

C:\Python27\ArcGIS10.2\lib\site-packages\scipy\spatial\__init__.py in <module>()
     89 from .kdtree import *
     90 from .ckdtree import *
---> 91 from .qhull import *
     92 from ._plotutils import *
     93

ImportError: DLL load failed: %1 is not a valid Win32 application.

Anyone had success install scipy with spatial functions on top of Esri's Python site-package (ArcPy)?

  • I have successfully used both together. Are you running 32bit or 64bit Python (e.g. which one is on your PATH environment variable)? What about installing scipy via PIP? – bcollins Oct 6 '14 at 22:02
  • No, PIP didn't work, or easy_install. Lots of errors. – JMT2080AD Oct 6 '14 at 22:31
6

The version of scipy that Christolph Gohlke has (very kindly) compiled is compiled against the version of numpy he's compiled with the against the Intel Math Kernel Library. This is different to the version of numpy that's released with ArcGIS, and as such won't work with the ArcGIS installed version.

Instead if you download scipy from the official SourceForge repository it should work.

  • That's it! I had noticed that at first, but had installed the version of numpy that Christolph compiled against as a solution. That caused other issues apparently. – JMT2080AD Oct 6 '14 at 22:29
0

The issue seems to be that the scipy supplied by ArcGIS depends on DLL's loaded by arcpy. So if you do import arcpy import scipy.spatial Then the error seems to go away. Without importing arcpy, you get this error.

Alternatively, if you add the directory C:\Program Files (x86)\ArcGIS\Desktop10.5\bin to your PATH, then the scipy libraries will find the arcpy DLL's that are needed.

  • Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. You appear to have created two accounts which inevitably leads to a frustrating experience for you, potential answerers and reviewers so please follow these instructions ASAP to merge your accounts. – PolyGeo Jul 29 '17 at 2:44

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.