<?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 Arcpy Runtime Error The Product License has not been initialized in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031337#M60161</link>
    <description>&lt;P&gt;I'm using ArcPy with multiprocessing to run area solar radiation tool. I keep getting this&amp;nbsp;"Runtime Error The Product License has not been initialized". The script is still running and I can get results. But I wonder if this slows down the process and how I can avoid this error. Here is how I set up the multiprocessing part&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# create a process pool&lt;BR /&gt;&lt;/SPAN&gt;pool = Pool(&lt;SPAN&gt;processes&lt;/SPAN&gt;=cpu_count())&lt;BR /&gt;pool.starmap(calcSolar,input_path)&lt;BR /&gt;pool.close()&lt;BR /&gt;pool.join()&lt;/PRE&gt;&lt;P&gt;I tried to change the number of processes and sometimes I didn't get this error. I'm very new to multiprocessing. Any help is appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 28 Feb 2021 16:51:49 GMT</pubDate>
    <dc:creator>ShirleyLi</dc:creator>
    <dc:date>2021-02-28T16:51:49Z</dc:date>
    <item>
      <title>Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031337#M60161</link>
      <description>&lt;P&gt;I'm using ArcPy with multiprocessing to run area solar radiation tool. I keep getting this&amp;nbsp;"Runtime Error The Product License has not been initialized". The script is still running and I can get results. But I wonder if this slows down the process and how I can avoid this error. Here is how I set up the multiprocessing part&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;# create a process pool&lt;BR /&gt;&lt;/SPAN&gt;pool = Pool(&lt;SPAN&gt;processes&lt;/SPAN&gt;=cpu_count())&lt;BR /&gt;pool.starmap(calcSolar,input_path)&lt;BR /&gt;pool.close()&lt;BR /&gt;pool.join()&lt;/PRE&gt;&lt;P&gt;I tried to change the number of processes and sometimes I didn't get this error. I'm very new to multiprocessing. Any help is appreciated!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 16:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031337#M60161</guid>
      <dc:creator>ShirleyLi</dc:creator>
      <dc:date>2021-02-28T16:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031339#M60162</link>
      <description>&lt;P&gt;see the code examples&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/spatial-analyst/area-solar-radiation.htm" target="_blank"&gt;Area Solar Radiation (Spatial Analyst)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;have you instantiated the spatial analyst extension by importing SA&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hljs-keyword"&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; arcpy.sa &lt;/SPAN&gt;&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Feb 2021 17:20:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031339#M60162</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-02-28T17:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031387#M60163</link>
      <description>&lt;P&gt;Are you using a single use license, pulling from a concurrent use license manager or via ArcGIS Online?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 00:02:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031387#M60163</guid>
      <dc:creator>AngusHooper1</dc:creator>
      <dc:date>2021-03-01T00:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031764#M60172</link>
      <description>&lt;P&gt;Yes. I imported arcpy.sa. I can get results though I got this error so I guess this configuration is okay but not optimal&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 01:42:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031764#M60172</guid>
      <dc:creator>ShirleyLi</dc:creator>
      <dc:date>2021-03-02T01:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031765#M60173</link>
      <description>&lt;P&gt;I'm using the python environment from Pro and it uses a concurrent use license. Do I need a single use license?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 01:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031765#M60173</guid>
      <dc:creator>ShirleyLi</dc:creator>
      <dc:date>2021-03-02T01:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031769#M60174</link>
      <description>&lt;P&gt;Double check the LM when you run this script. You may be borrowing a license per multiprocess thread and hitting a cap.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 02:49:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1031769#M60174</guid>
      <dc:creator>AngusHooper1</dc:creator>
      <dc:date>2021-03-02T02:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1032591#M60188</link>
      <description>&lt;P&gt;I would check out and check in the spatial analyst extension in the worker function you are calling through multiprocessing.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 19:57:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1032591#M60188</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-03-03T19:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1036346#M60391</link>
      <description>&lt;P&gt;I have the exactly the same Error. My script only uses arcpy in one step before the multiprocessing but not in the function used in the multiprocessing which is handled completely with gdal. This error occurs most of the times bu not always and apparently is related when the function modifies a numpy array or when the array is written in the band. I cannot understand what triggers the error because no arcpy method is called during the process.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def calculateStats(*args):
   # This function doesn't use arcpy

f = functools.partial(calculateStats, in_data=in_data, z_data=z_data, out=out)
with multiprocessing.Pool(processes=2) as pool:
   res = pool.map(f, coordinates)

Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
........
from ._arcgisscripting import *
RuntimeError: The Product License has not been initialized.&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I'm working in a conda env I created with its arcpy installation. However, apparently arcpy points to a different installation.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;sys.executable
Out[17]: '\\Anaconda3\\envs\\py37\\python.exe'
multiprocessing.__file__
Out[13]: '\\Anaconda3\\envs\\py37\\lib\\multiprocessing\\__init__.py'
arcpy.__file__
Out[14]: '\\AppData\\Local\\Programs\\ArcGIS\\Pro\\Resources\\ArcPy\\arcpy\\__init__.py'&lt;/LI-CODE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 19:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1036346#M60391</guid>
      <dc:creator>AlfonsoYanezMorillo</dc:creator>
      <dc:date>2021-03-14T19:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy Runtime Error The Product License has not been initialized</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1036367#M60392</link>
      <description>&lt;P&gt;arcpy uses your Pro environment unless your clone includes it, it won't be available&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 21:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-runtime-error-the-product-license-has-not/m-p/1036367#M60392</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-14T21:17:14Z</dc:date>
    </item>
  </channel>
</rss>

