ArcGIS Pro Runtime Error: the product license has not been initialized

24903
32
Jump to solution
02-03-2021 10:44 AM
chintakandel
New Contributor III

I've issue license initialization in ArcGIS Pro 2.7. I can run python script manually via command line and batch file but encountered with following run time error with scheduled task in Windows server 2019. 

File "C:\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
File "C:\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgisscripting\__init__.py", line 128, in <module>
from ._arcgisscripting import *
RuntimeError: The Product License has not been initialized.

Any ideas or solutions?

Thanks in advance,

Chintamani

32 Replies
Jen_Zumbado-Hannibal
Occasional Contributor

This worked great! Thanks. 

Jen Zumbado-Hannibal, GISP
GIS Coordinator
City of Forest Grove
Forest Grove, OR 97116

by Anonymous User
Not applicable

Our configuration is different than any other helpful threads - here is our config and solution.

Config: We have a dedicated scripting server (WS 2016); default Pro 2.9.1 install; custom cloned environment in "C:\Python3x\...\our_clone"; scripts on local and network drives; tasks run as a domain\service account that we cannot use as machine login; concurrent license

Solution:

  1. Task Manager:
    • General: Run as <domain\service acct>; Whether logged in or not; Highest Privileges (may not be necessary)
    • Action: 
      • Program: C:\Python3x\...\our_clone\python.exe
      • Argument: \\path\\to\\script.py (or c:\path\to\script.py)
    • <everything else default>
  2. ArcPro
    • Right-click application --> more --> run as different user
    • (log in with service account credentials)
    • In the sign-in window, click the configure license settings in the lower left.
      • 2nd time logging in opens Pro - go to Settings\Licensing
    • Change license type to Concurrent and set your license manager
    • Do NOT "Authorize Pro to work offline"

Our biggest problem was initializing the Arc license, which was due to the service account and Pro relationship. Several threads mention logging in as the Scheduled Task user, but that was not possible for us. I often Run As Admin, but had forgotten about the option to log into the application as the service account.   

Other Attempts:

  1. Setting Pro to work offline (I'm very glad this didn't fix our issue because Pro checks the license back in automatically after X period of time - wouldn't work well in our system of automation)
  2. Task manager\Action: "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy"
    • command not recognized.
  3. Task manager\Action: "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy.bat"
    • successfully recognizes cloned env, but still failed on import arcpy
    • I vaguely recall this command resolving to Pro's env once, so there may be some activation required.
    • as mentioned above, pointing the task directly to the clone's python.exe works and is very clear
  4. Task Manager\Action "Start in" had no affect regardless what path I entered
  5. using batch files with conda activation and python execution
LauraTateosian
New Contributor III

Hi RickMomsen1,

I'm facing a similar issue and your setup sounds similar to ours.  It's a server machine that needs to trigger some Python scripts.   

But I'm not sure what you mean by "service account".    Does that require a special kind of license?

 

0 Kudos
chintakandel
New Contributor III

We’re using service account as admin account. Ignore service account if you are using admin account for your computer.

 

0 Kudos
LauraTateosian
New Contributor III

Hi,  Thank you for posting this information.  I tried to follow this procedure, but perhaps when you said "Task Manager", you meant "Task Scheduler"?  The Task Manager doesn't have an Action option, but the Scheduler does.  It looks like this solution will not work for me, as I'm not triggering the script through a scheduled task.

0 Kudos
LauraTateosian
New Contributor III

Thanks, our IT is setting up such an account.  I hope it works.  I'll post again either way.

0 Kudos
LauraTateosian
New Contributor III

Though related, my target functionality is a bit different from what is posted here.  I'm not triggering the run from a Task Manager.  It's triggered by PHP code.  I can't figure out what the equivalent of setting the task manager's privileges would be.  

0 Kudos
chintakandel
New Contributor III

I think you have to run Task Manager as administrator or service account to access system tools. You may require to run ArcGIS Pro as admin.

0 Kudos
LauraTateosian
New Contributor III

Hi Chintakandel,

I can run as administrator.   Can you tell me which system tools are involved?

0 Kudos
Cristian_Galindo
Occasional Contributor III

I am suffering from the same behavior:

File ".\Arcpy\PublishService.py", line 9, in <module>
    import arcpy
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 88, in <module>
    from arcpy.geoprocessing import gp
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
    from ._base import *
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
    import arcgisscripting
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgisscripting\__init__.py", line 128, in <module>
    from ._arcgisscripting import *
RuntimeError: The Product License has not been initialized.



the characteristics of my environment:

ArcGIS pro 2.9.3

ArcGIS Pro Named User License

 

The processes were running with out issue, but since yesterday it start with this issue, as it can be seen in the code above, the error is triggered when the script reach the import arcpy command.

An special consideration: I have a set of 5-6 scripts that runs over 4 geodatabases, all of them are orchestrated to be run sequentially by a service (the service runs under the same credentials as the ArcGIS Pro application was configured and executed  - you know...the profile cookie mentioned above), but not all the scripts fail, and the failing ones are not always the same.

I even have a script made in PowerShell that uses the ArcGIS.Core.Hosting.dll, it is failing too when the initialization is called.

 

 

 

0 Kudos