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.
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 "<string>", line 1, in <module>
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.
I'm working in a conda env I created with its arcpy installation. However, apparently arcpy points to a different installation.
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'
Thanks