<?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: Spatial Statistics: Mean Center tool failed to work in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757465#M58463</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan and Curtis. After I removed the python installed by Anaconda, the tool worked! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Sep 2017 17:26:17 GMT</pubDate>
    <dc:creator>NaAn1</dc:creator>
    <dc:date>2017-09-07T17:26:17Z</dc:date>
    <item>
      <title>Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757461#M58459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to generate the weighted centroid point using Mean Center tool. But it failed with the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.MeanCenter_stats('Zip5_all_air', r'C:\Users\nanamzn\Documents\ArcGIS\Default.gdb\Zip3_MeanCenter', 'PackageNumber', '#', '#')&lt;BR /&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\stats.py", line 1231, in MeanCenter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError:&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\ArcToolbox\Scripts\MeanCenter.py", line 25, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import SSUtilities as UTILS&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\ArcToolbox\Scripts\SSUtilities.py", line 29, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import matplotlib.path as PATH&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 129, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from matplotlib.externals.six.moves.urllib.request import urlopen&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 90, in __get__&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = self._resolve()&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 158, in _resolve&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module = _import_module(self.mod)&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\externals\six.py", line 80, in _import_module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __import__(name)&amp;nbsp;&amp;nbsp; File "C:\Anaconda2\Lib\urllib2.py", line 94, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import httplib&amp;nbsp;&amp;nbsp; File "C:\Anaconda2\Lib\httplib.py", line 72, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import socket&amp;nbsp;&amp;nbsp; File "C:\Anaconda2\Lib\socket.py", line 47, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import _socket ImportError: DLL load failed: %1 is not a valid Win32 application.&amp;nbsp; Failed to execute (MeanCenter). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I uninstalled Anaconda2 from my machine and rerun the tool. It failed again with different error. May I ask how to fix the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.MeanCenter_stats('Zip5_all_air', r'C:\Users\nanamzn\Documents\ArcGIS\Default.gdb\Zip3_MeanCenter1', 'PackageNumber', '#', '#')&lt;BR /&gt;Runtime error&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\stats.py", line 1231, in MeanCenter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e ExecuteError:&amp;nbsp; Traceback (most recent call last):&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\ArcToolbox\Scripts\MeanCenter.py", line 25, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import SSUtilities as UTILS&amp;nbsp;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.5\ArcToolbox\Scripts\SSUtilities.py", line 29, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; import matplotlib.path as PATH&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 1138, in &amp;lt;module&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rcParams = rc_params()&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 971, in rc_params&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fname = matplotlib_fname()&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 800, in matplotlib_fname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; configdir = _get_configdir()&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 655, in _get_configdir&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _get_config_or_cache_dir(_get_xdg_config_dir())&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 580, in _get_xdg_config_dir&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = get_home()&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 320, in wrapper&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret = func(*args, **kwargs)&amp;nbsp;&amp;nbsp; File "C:\Python27\ArcGIS10.5\lib\site-packages\matplotlib\__init__.py", line 522, in _get_home&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding()) LookupError: unknown encoding: mbcs&amp;nbsp; Failed to execute (MeanCenter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 00:41:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757461#M58459</guid>
      <dc:creator>NaAn1</dc:creator>
      <dc:date>2017-09-07T00:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757462#M58460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When running the following script in windows command line. It works:&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;... arcpy.MakeFeatureLayer_management(r'C:\ArcGIS_data_analysis\test.gdb\Zip5', "Zip5_point_lyr")&lt;BR /&gt;... arcpy.MeanCenter_stats('Zip5_point_lyr', r'C:\ArcGIS_data_analysis\Centroid_analysis\Centroid.gdb\test', 'PackageNumber', 'Zip3', 'PackageNumber')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why does this happen?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 01:25:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757462#M58460</guid>
      <dc:creator>NaAn1</dc:creator>
      <dc:date>2017-09-07T01:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757463#M58461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you have a couple of versions of python lurking around.&lt;/P&gt;&lt;P&gt;ArcMap uses 2.7 32bit and your command line prompt should look like this&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/370163_ArcMap_python_version.png" style="width: 620px; height: 114px;" /&gt;&lt;/P&gt;&lt;P&gt;make sure you don't have a 64 bit version installed.&lt;/P&gt;&lt;P&gt;To be sure, you can uninstall all versions of python then do a repair installation of ArcMap to get the right python installed in the C:\Python27\ArcGIS10.5.... file location&lt;/P&gt;&lt;P&gt;To get python 3.x, install ArcGIS Pro, it sets up a conda distribution separate from other version of python&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 02:03:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757463#M58461</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-09-07T02:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757464#M58462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan is absolutely right, this is a Python issue, not a issue with the tool. I suspect&amp;nbsp;you have some non-ArcGIS versions of Python installed that messed with the paths. The issue really is how weak Windows is with how it handles paths. &amp;nbsp;The way most people get into this trouble is when they install Anaconda and neglect to un-check&amp;nbsp;the boxes that modify&amp;nbsp;the Windows environment. A sure way to break the Windows setup ArcGIS needs to properly communicate with the correct Python executables and environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fix is to go to Add/Remove programs and remove any Python installs you see, then run a repair install of ArcGIS Desktop (and ArcGIS 64 bit&amp;nbsp;Background Processing, and Pro, if that's installed too). This will get you on the true Python path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 03:09:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757464#M58462</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-09-07T03:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757465#M58463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan and Curtis. After I removed the python installed by Anaconda, the tool worked! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 17:26:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757465#M58463</guid>
      <dc:creator>NaAn1</dc:creator>
      <dc:date>2017-09-07T17:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757466#M58464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great! I was inspired to create a blog post that hopefully will come in future searches by others feeling similar pain.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/people/curtvprice/blog/2017/09/07/python-tool-fails-with-not-a-valid-win32-application?sr=search&amp;amp;searchId=c4023bc1-7cab-4b55-9efd-1c3346209286&amp;amp;searchIndex=0"&gt;https://community.esri.com/people/curtvprice/blog/2017/09/07/python-tool-fails-with-not-a-valid-win32-application?sr=search&amp;amp;searchId=c4023bc1-7cab-4b55-9efd-1c3346209286&amp;amp;searchIndex=0&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 21:06:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757466#M58464</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-09-07T21:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Statistics: Mean Center tool failed to work</title>
      <link>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757467#M58465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have just run on the same issue. Just to let you know that I had removed all other Python installs and keep the one ArcMap is using. I have run the Mean Center again and it worked. I did not even have to&amp;nbsp;run a&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;repair install of ArcGIS Desktop. Thanks for help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2020 14:18:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/spatial-statistics-mean-center-tool-failed-to-work/m-p/757467#M58465</guid>
      <dc:creator>MajaTurkalj</dc:creator>
      <dc:date>2020-01-15T14:18:19Z</dc:date>
    </item>
  </channel>
</rss>

