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

24725
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

1 Solution

Accepted Solutions
Robert_LeClair
Esri Notable Contributor

What type of ArcGIS Pro license are you using?  Named User, Concurrent or Single Use?  I found one case with this messaging where the customer changed the ArcGIS Pro license from Named User to Single Use license - this corrected the error message.  The error could have been thrown if the account running the script has never opened ArcGIS Pro, thus no roaming profile exists.  The analyst and customer tested the workflow using a Single Use license and it worked properly.  Hope this helps!

View solution in original post

32 Replies
Robert_LeClair
Esri Notable Contributor

What type of ArcGIS Pro license are you using?  Named User, Concurrent or Single Use?  I found one case with this messaging where the customer changed the ArcGIS Pro license from Named User to Single Use license - this corrected the error message.  The error could have been thrown if the account running the script has never opened ArcGIS Pro, thus no roaming profile exists.  The analyst and customer tested the workflow using a Single Use license and it worked properly.  Hope this helps!

chintakandel
New Contributor III

Hi Robert, 

Thank you for your suggestion. Worked after running Pro with the account that is used to schedule task to run script.

Thanks,

Chintamani 

VithushanLogan
New Contributor II

Hi @Robert_LeClair, I was working on the automation project using ArcGIS Pro and Lambda. The simple idea of the workflow lambda triggers the Ec2 instance to run some Python scripts related to the Arcpy module. In this process when lambda triggers the Python script in the Ec2 instance, throws some errors (Error in JSON format)

RuntimeError: The Product License has not been initialized.\r\n', 'StandardErrorUrl': '', 'CloudWatchOutputConfig': {'CloudWatchLogGroupName': '', 'CloudWatchOutputEnabled': False},

Can I know how to resolve it?

0 Kudos
Robert_LeClair
Esri Notable Contributor

Hi @VithushanLogan - unfortunately this question is outside of my knowledge base - @JeffBigos - are you aware of how to accomplish this workflow?

0 Kudos
NathanHeickLACSD
Occasional Contributor III

Yes, I had a similar issue and just wanted to add my experience to the list.  I had a scheduled task that had been working for a while with no problems.  All of a sudden, I stopped getting email messages from the script.  The script wasn't capturing all exceptions in the code, just those in the main block of business logic.  So, it was not catching this error, which was causing the Scheduled Task to fail with code 2147942401.  Like you, I just opened ArcGIS Pro and signed into a named user account and the script started working.

Could you explain Robert what might have changed?  I haven't logged into ArcGIS Pro on that machine in a while, but it was working a few months ago.

0 Kudos
Tom_Laue
New Contributor III

 

I’ve been encountering similar issues.  I have found that ArcGIS Pro (which we license through AGOL) automatically logs itself out of every 90 days. I have many Arcpy scripts running via Task Scheduler 24/7.

 

Also, periodically (usually once a day at a specific time) scripts will fail saying “RuntimeError: The Product License has not been initialized.”  No idea what is causing this error as this script runs all day every 30 mins and never gets this error the rest of the day.

 

 

ESRI Tech Support sent me this suggestion which we have yet to implement…

 

 

-------------------------------------------

 

We’ve done a bit of digging into our documentation and might have a solution for you. The bad news is, it doesn’t look like there’s a good way to handle the Pro license refresh through Python. The good news is, there is a promising option for handling it in your environment directly. Please see below for a configuration step-by-step that should solve your logout issue:

 

Step 1: Environmental settings

  1. Convert your Named license to a Single Use license for this instance of Pro (if you haven’t already). See https://pro.arcgis.com/en/pro-app/latest/get-started/convert-named-user-licenses-to-single-use.htm for more details on how to configure this. This should allow offline access for Pro.
  2. Make sure “Sign me in automatically” remains checked when you log into Pro on this machine. Just in case.

 

Step 2: Caching local user (src: https://community.esri.com/t5/python-questions/arcpy-fails-to-import-when-not-logged-into-host-machi...)

  1. Log into the server that will host the script using the username that will be running the script (i.e. the “owner” in task scheduler).
  2. Once logged in, open ArcGIS Pro (this will create an esri profile cookie in your AppData folder, that ArcGIS will be able to use to recognize the user).
  3. Make sure your license and configurations are set according to step 1 and close Pro.

 

Step 3: Just in case… (src: https://community.esri.com/t5/arcgis-pro-questions/running-a-scheduled-task-on-a-server-machine/m-p/...)

  1. If the issue persists after running through steps 1 and 2, it means that your Pro configuration requires the application to be open while running scripts against its library, for whatever reason. If this is the case, and only after completing steps 1 and 2, we recommend you include a task before the script in your task scheduler that will open ArcGIS Pro, to remove any weird library locks. This is an edge case but does appear to affect some users, so I wanted to include it in the outline.

 

 

AlexisHandelman
New Contributor II

Have you implemented these steps and have they worked? We are experiencing the same thing as you. We cannot figure out what is causing Pro to log out. We were trying to avoid converting to single-use license though. 

0 Kudos
Tom_Laue
New Contributor III

I have not had a chance to implement this yet.

0 Kudos
RobertStevens
Occasional Contributor III

This procedure did nothing.

I ssh to the client windows 10 box, try to run python with arcpy
and still get the same message after having spent 30 mins of my time
going throught the involved procedure of converting to a single
user license.

0 Kudos