<?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: using mutiprocessing module - can't find python.exe anymore? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246920#M19130</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;BTW: Jason, do you/ESRI have any multiprocessing/subprocess/parallelpython examples using arcpy/gp? More examples, the better... I've seen only a handfull of examples for multiprocessing with arcypy (well actually only one).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, Do you personally (so as not to confuse it with your employer) have any recomendations about the "best" method use for parallel processing in Python using ESRI objects??? I'm trying to modernize my parallel scripts that use the (antiquated?) os.spawnv, and am seeing a lot of different options such as parallel python, multiprocessing, subprocess, etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any recomendations?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Aug 2011 15:04:37 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2011-08-25T15:04:37Z</dc:date>
    <item>
      <title>using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246914#M19124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I finally had a good reason to start writing an arcpy script that uses the multiprocessing module (new in v2.6). Great! I start coding following this example: &lt;/SPAN&gt;&lt;A href="http://pythongisandstuff.wordpress.com/2011/07/11/using-arcpy-with-multiprocessing-%E2%80%93-part-3/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://pythongisandstuff.wordpress.com/2011/07/11/using-arcpy-with-multiprocessing-%E2%80%93-part-3/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run my script it throws this weird error when it gets to the multiprocessing part:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A new PythonWin window pops up with an error "Could not load the file from C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oh crap...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I go to a coworkers machine and try to run my script.... Same error!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a long while I deduce that for whatever reason the mutiprocessing module can't find python.exe anymore. I debug it untill I finally get to the problem: line 179 in the "forking.py" script (C:\Python26\ArcGIS10.0\Lib\multiprocessing\Forking.py). Here is that code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if sys.executable.lower().endswith('pythonservice.exe'):
&amp;nbsp;&amp;nbsp; _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
else:
&amp;nbsp;&amp;nbsp; _python_exe = sys.executable&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Problem is that the executable I am using DOES NOT end with "pythonservice.exe" (cause I am using PythonWin.exe!), so it reverts to using whatever the sys.executable variable points to (which is pythonwin.exe). Ah ah!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, of course when I hardcode the offending lines of code to be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if sys.executable.lower().endswith('pythonservice.exe'):
&amp;nbsp;&amp;nbsp; _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
else:
&amp;nbsp;&amp;nbsp; _python_exe =&amp;nbsp; os.path.join(sys.exec_prefix, 'python.exe')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Everything works fine!!! AWESOME!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So my questons are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. If my coworker and I are having this issue, is anyone else have this issue? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Why can't the multiprocessing module find python.exe? Could it be related to arcpy "taking over" the Python install directory???&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Other than hardcoding the correct path to python.exe in the "forking.py" script, what can I do to make a permanent fix for this? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P.S. Setting the PYTHONPATH system variable doesn't do the trick...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;....Also, running ArcGIS v10.0 SP2, Windows7&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:17:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246914#M19124</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T12:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246915#M19125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;can't help it ... are you sure that "forking.py" is spelled correctly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 00:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246915#M19125</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-08-25T00:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246916#M19126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, forking with python is pretty interesting...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I though the comment in the f{o,u}rking script on line 174-177 was kinda fishy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#
# _python_exe is the assumed path to the python executable.
# People embedding Python want to modify it.
#&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:17:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246916#M19126</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T12:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246917#M19127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;best of luck... been playing with recarrays and I been having difficulty with spelling as of late&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 01:36:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246917#M19127</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-08-25T01:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246918#M19128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You may want to do it&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://docs.python.org/release/2.6.7/library/multiprocessing.html#multiprocessing.set_executable"&gt;the documented way&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 04:04:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246918#M19128</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-08-25T04:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246919#M19129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;...docume-what? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;multiprocessing.set_executable()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A million thanks Jason!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 14:34:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246919#M19129</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-08-25T14:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246920#M19130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;BTW: Jason, do you/ESRI have any multiprocessing/subprocess/parallelpython examples using arcpy/gp? More examples, the better... I've seen only a handfull of examples for multiprocessing with arcypy (well actually only one).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, Do you personally (so as not to confuse it with your employer) have any recomendations about the "best" method use for parallel processing in Python using ESRI objects??? I'm trying to modernize my parallel scripts that use the (antiquated?) os.spawnv, and am seeing a lot of different options such as parallel python, multiprocessing, subprocess, etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any recomendations?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 15:04:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246920#M19130</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-08-25T15:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246921#M19131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think a couple are due up on the geoprocessing resource center in the coming weeks, if I'm not mistaken.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 15:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246921#M19131</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-08-25T15:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: using mutiprocessing module - can't find python.exe anymore?</title>
      <link>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246922#M19132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Cool - looking forward to seeing those...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW: WOW! Looks like you can now finally process Spatial Analyst tools in parallel now in v10/arcpy. Regardless it took me a year to realize it, that little discovery this morning made my day (probably my year actually!). Never noticed that (***very important to me***) tidbit in any of the "what's new in v10" documents... Man, I would have totally gone to arcpy right away (like a fly to sh*%!) had I noticed that sooner!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway - whoohoo! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 16:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-mutiprocessing-module-can-t-find-python-exe/m-p/246922#M19132</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-08-25T16:17:01Z</dc:date>
    </item>
  </channel>
</rss>

