<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SciPy.ndimage and ArcGIS Tools in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724054#M56065</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hei again &lt;A href="https://community.esri.com/migrated-users/31672"&gt;Shaun Walbridge&lt;/A&gt;​!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just got ArcGIS Pro up and running, and with only minor alterations to the code I got i working seamlessly with ArcGIS Python 3.4. The SciPy-version packaged with ArcGIS Pro has all the tools in I need for the job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great stuff, and a nice entry point for me to slowly convert to ArcGIS Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Sep 2015 13:21:06 GMT</pubDate>
    <dc:creator>TobiasLitherland</dc:creator>
    <dc:date>2015-09-09T13:21:06Z</dc:date>
    <item>
      <title>SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724048#M56059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have just discovered the scipy.ndimage.label method, which is just amazing at simple raster object detection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made a script that uses this method extensively, and would like to create a script tool in an arcgis toolbox.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that I am not able to get a working install of scipy with native arcgis python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution has been to install Anaconda Python in parallell with ArcGIS Python, and then make the tool run the script via the command line using the Anaconda Python passing the GetParameterAsText's as command line arguments:&lt;/P&gt;&lt;P&gt;os.system('C:\...\Anaconda\python.exe "C:\GIS_Scripts\...\My_script.py" "arg1" "arg2" "arg3"')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works, but it lacks proper error propagation and messages to the tool window in ArcMap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, two questions:&lt;/P&gt;&lt;P&gt;1) Have any of you managed to use SciPy with native ArcGIS python, and if you have, can you make scipy.ndimage work? I seem to constantly be missing some module references.&lt;/P&gt;&lt;P&gt;2) Is there any way to decouple the native Python install, and make ArcGIS use another python executable but while still making arcpy available?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 11:29:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724048#M56059</guid>
      <dc:creator>TobiasLitherland</dc:creator>
      <dc:date>2015-07-16T11:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724049#M56060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/100736"&gt;Tobias Litherland&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sounds great what you are working on. The first question that comes into mind is the version of ArcGIS that you are using. Esri has announced the integration of SciPy and ArcGIS (see &lt;A href="http://www.esri.com/esri-news/releases/14-4qtr/esri-advances-scientific-analysis-with-scipy" title="http://www.esri.com/esri-news/releases/14-4qtr/esri-advances-scientific-analysis-with-scipy"&gt;Esri Advances Scientific Analysis with SciPy&lt;/A&gt; ) and is investing a lot of effort to offer more functionality and integration with the scientific community (see this white paper, July 2015): &lt;A href="http://www.esri.com/library/whitepapers/pdfs/esri-and-the-scientific-community.pdf" title="http://www.esri.com/library/whitepapers/pdfs/esri-and-the-scientific-community.pdf"&gt;http://www.esri.com/library/whitepapers/pdfs/esri-and-the-scientific-community.pdf&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to mention &lt;A href="https://community.esri.com/migrated-users/31672"&gt;Shaun Walbridge&lt;/A&gt; and &lt;A href="https://community.esri.com/migrated-users/29300"&gt;Kevin Butler&lt;/A&gt; who gave a great &lt;A href="https://4326.us/scipy/#/"&gt;presentation at the DevSummit 2015&lt;/A&gt; (&lt;A href="https://4326.us/scipy/#/" title="https://4326.us/scipy/#/"&gt;https://4326.us/scipy/#/&lt;/A&gt; ) about ArcGIS and working with Scientific Data the SciPy Stack, to see if they are listening and can help you further. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also be interested in this blog post: &lt;A href="http://blogs.esri.com/esri/arcgis/2015/04/01/esri-and-the-science-community-the-year-ahead/" title="http://blogs.esri.com/esri/arcgis/2015/04/01/esri-and-the-science-community-the-year-ahead/"&gt;Esri and the Science Community: The Year Ahead | ArcGIS Blog&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Xander&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 11:49:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724049#M56060</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-07-16T11:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724050#M56061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A href="https://community.esri.com/migrated-users/38687" target="_blank"&gt;Tobias Litherland&lt;/A&gt;​ (and thanks for the heads-up &lt;A href="https://community.esri.com/migrated-users/3100" target="_blank"&gt;Xander Bakker&lt;/A&gt;​):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have Pro installed, that's the easiest route -- it ships with SciPy, and is usable today. Further improvements are coming soon to our other products, but that doesn't help you for solving your immediate needs. For that, you can try using Python path files (.pth) to bridge between the environments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WARNING&lt;/STRONG&gt;: This approach is risky, and can potentially break your Python installation, so be careful, and this isn't a directly supported method. Because you're using different versions of packages like NumPy under the hood, strange things can happen, and sometimes introduce crashes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Find the site packages path for your Anaconda install. On my machine, it was &lt;TT&gt;C:\Miniconda\envs\default\Lib\site-packages&lt;/TT&gt;. Copy that path into a file called &lt;TT&gt;anaconda.pth&lt;/TT&gt;.&lt;/P&gt;&lt;P&gt;2. Copy &lt;TT&gt;anaconda.pth&lt;/TT&gt; into &lt;TT&gt;C:\Python27\ArcGIS10.3\Lib\site-packages&lt;/TT&gt; (or the correct location if you used a different installation path).&lt;/P&gt;&lt;P&gt;3. Open Python, type:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys
print(sys.path)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it worked correctly, you should see a new entry for the Anaconda environment from within the ArcGIS installed version of Python, and &lt;TT&gt;import scipy&lt;/TT&gt; should work. Again, note that this may cause other problems, and if anything is breaking, delete the pth file to return your setup to a stock install.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shaun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:58:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724050#M56061</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-12T06:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724051#M56062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all the info, &lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking forward to more integration of SciPy in ArcGIS, as the speed and functionality of some of the methods in the module just blows Spatial Analyst out of the water (I'm sorry to say!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the white papers and the power points from the DevSummit presentations, but I did not seem to find any substantial information on ha to actually make the bridge work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS Desktop 10.3 Advanced.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 06:40:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724051#M56062</guid>
      <dc:creator>TobiasLitherland</dc:creator>
      <dc:date>2015-07-17T06:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724052#M56063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/31672"&gt;Shaun Walbridge&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the heads-up!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I generally do most of my work in scripts via Anaconda, and my Anaconda install references the arcpy site package via a .pth-file. I hoped that the same would work the other way, and had tried it, but it seems like something is missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added &lt;STRONG&gt;C:\...\Anaconda\Lib\site-packages&lt;/STRONG&gt; to &lt;STRONG&gt;anaconda.pth&lt;/STRONG&gt; and placed this in the &lt;STRONG&gt;C:\Python27\ArcGIS10.3\Lib\site-packages.&lt;/STRONG&gt; I was then able to &lt;EM&gt;import scipy&lt;/EM&gt; but if i attempt &lt;EM&gt;import scipy.ndimage&lt;/EM&gt; it failed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7ed529;"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt; import scipy&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7ed529;"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt; import scipy.ndimage&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;Runtime error &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "C:\Users\u34386\AppData\Local\Continuum\Anaconda\Lib\site-packages\scipy\ndimage\__init__.py", line 172, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from .filters import *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp; File "C:\Users\u34386\AppData\Local\Continuum\Anaconda\Lib\site-packages\scipy\ndimage\filters.py", line 36, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from . import _nd_image&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;ImportError: numpy.core.multiarray failed to import&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that this is the mismatch in numpy-versions you mentioned. It would explain why the scipy.ndimage import failes at least, but at the same time it is strange that scipy seems to work (apparently).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have access to Pro, so that might actually be a solution. I'll check it out. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 06:58:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724052#M56063</guid>
      <dc:creator>TobiasLitherland</dc:creator>
      <dc:date>2015-07-17T06:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724053#M56064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, that's what I'd expect out of the box with Conda -- the version of NumPy that is on your sys.path is 1.7.1, and the version in Conda is 1.9.1 -- NumPy is not ABI compatible between major releases. If you want to stick to ArcMap, you can try making a environment with NumPy 1.7.1 and a related SciPy release, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;conda install numpy=1.7.1&lt;P&gt;conda install scipy=0.13.2&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And see if it works linked against that conda environment. Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 07:14:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724053#M56064</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2015-07-17T07:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724054#M56065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hei again &lt;A href="https://community.esri.com/migrated-users/31672"&gt;Shaun Walbridge&lt;/A&gt;​!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just got ArcGIS Pro up and running, and with only minor alterations to the code I got i working seamlessly with ArcGIS Python 3.4. The SciPy-version packaged with ArcGIS Pro has all the tools in I need for the job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great stuff, and a nice entry point for me to slowly convert to ArcGIS Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2015 13:21:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724054#M56065</guid>
      <dc:creator>TobiasLitherland</dc:creator>
      <dc:date>2015-09-09T13:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: SciPy.ndimage and ArcGIS Tools</title>
      <link>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724055#M56066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great! Glad to hear it. The 10.4 release will include the same packages currently included in Pro, so you should be able to write code that will work equally well in both ArcMap and Pro at that point. Let us know if you have any further issues, and look forward to hear more about your work with raster object detection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shaun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2015 14:21:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scipy-ndimage-and-arcgis-tools/m-p/724055#M56066</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2015-09-09T14:21:40Z</dc:date>
    </item>
  </channel>
</rss>

