Hello,
I am using the Empirical Bayesian Kriging geoprocessing tool in a workflow. In ArcGIS Pro, I am using a named user licence (from Arcgis Enterprise Portal) with the GeoStats extension enabled (working when it is executed from the geoprocessing toolbar in Arcgis Pro).
However, I encounter problems when I use it in Model Builder and in the Python script in VS Code (using the Python environment installed with ArcGIS Pro 3.11.11). As the workflow is quite long, we would like to use a Python script or Model Builder.
Within the Python script, I integrated a licence check, showing that the GeoStats extension is not available, which is strange. Also the check in the Python Interactive Terminal stats not licensed.
Has anyone had similar problems or has some ideas to fix it?
Thanks.
Licenses and extensions access in Python—ArcGIS Pro | Documentation
Perhaps showing portions of your script might help narrow down your use of CheckInExtension and CheckOutExtension.
and how you have authorized python to use them
Authorize Python outside the application
Here is a sample I am currently using
import arcpy
import os
import traceback
import sys
from arcgis.gis import GIS
# Connect to the active portal
# Get the active portal user
gis = GIS("pro") # Uses the active ArcGIS Pro sign-in session
print(gis.users.me)
print(arcpy.GetInstallInfo()["Version"])
# Get current active Portal
portal_url = arcpy.GetActivePortalURL()
print(f"Active portal: {portal_url}")
def trench():
try:
arcpy.env.overwriteOutput = True
# Check license
if arcpy.CheckExtension("GeoStats") == "Available":
arcpy.CheckOutExtension("GeoStats")
else:
raise Exception("GeoStats Extension not available!")
# Paths
input_fc = r"C:\abc"
buffer_fc = r"C:\abc"
existing_raster = arcpy.Raster(r"C:\abc")
output_gdb = r"C:\abc"
output_raster_path = os.path.join(output_gdb, "TRENCH_NEW")
output_tif = r"C:\abc"
# Check GDB
if not arcpy.Exists(output_gdb):
raise Exception(f"GDB not found: {output_gdb}")
# Create Feature-Layer
arcpy.MakeFeatureLayer_management(input_fc, "points_lyr")