Get the ArcGIS Pro Version and the License in-use using ArcPy

Table of Contents

Introduction

A nice little code snippet that will allow you to access the version of ArcGIS Pro running the code and the license level in use. These are often required when you know some of your code will not run with certain versions or without a certain level of license.

Leverage ArcPy for geospatial data management workflows within ArcGIS Pro. Learn the fundamentals of utilising ArcGIS Pro geoprocessing tools with ArcPy for data management, conversions, and analysis. This course is packed with amazing content that will help you discover the power of automating tasks within the ArcGIS Pro environment. Take your ArcPy skills from beginner to snake charmer. A little code goes a long way, a little ArcPy provides you with an in-demand skill. Sign up now for our highly rated course.

Import the ArcPy module

ArcPy is a Python site package that enables automation, analysis, and management of geographic data within the ArcGIS software environment. 

				
					import arcpy

				
			

Get the GetInstallInfo() dictionary

The GetInstallInfo() ArcPy function returns a dictionary containing the “Version” of ArcGIS Pro installed, and the current “LicenseLevel” – Basic, Standard, Advanced. The dictionary also contains information for the “Installer” – who installed the software, “InstallDate” and “InstallTime” amongst others.

				
					arcpro_version = arcpy.GetInstallInfo()
				
			

Get the version of ArcGIS Pro in use

To get the version of ArcGIS Pro in use we access the “Version” key from the GetInstallInfo() dictionary which will return a string defining the version – ‘3.2’, ‘3.3’ for examples.

				
					pro_version = install_info["Version"]
				
			

Get the license level in use

To get the current license level in use we access the “LicenseLevel” key from the GetInstallInfo() dictionary which will return a string containing ‘Basic’, ‘Standard’, or ‘Advanced’ based on the user who run the script. We can also access the license level via the ProductInfo() ArcPy function.

				
					pro_license = install_info["LicenseLevel"]
				
			
				
					## alternate option for getting the license level
license_dict = {
    "ArcView" : "Basic",
    "ArcEditor" : "Standard",
    "ArcInfo" : "Advanced"
}

pro_license = license_dict[arcpy.ProductInfo()]
				
			

Test for license level and version

Some tools require a certain level of license to run and others will fail if they are using a geoprocessing tool available from a certain version onwards. These can be good to catch in your scripts. For example, at version 3.2, the SearchCursor added a spatial_filter parameter. Any version prior to 3.2 would not be able to execute to completion if the tool utilises the spatial_filter option.

				
					if pro_license != "Advanced":
    arcpy.AddWarning("Advanced license required to run this tool")
    
elif not float(pro_version) >= 3.0:
    arcpy.AddWarning("ArcGIS Pro 3.0 or greater required to run this tool")
    
else:
    # do something cool with arcpy
				
			

Mastering ArcGIS Pro ArcPy Search, Insert, & Update Cursors

Unlock the full potential of ArcPy Cursors with our intensive and in-depth course. Designed for GIS professionals, analysts, and enthusiasts, this course delves into the intricacies of Search, Insert, and Update Cursors in the ArcPy library, empowering you to manipulate and manage spatial data with precision and efficiency.

ArcPy Cursors enable you to streamline your GIS workflows, automate repetitive tasks, and witness the full potential of spatial data manipulation in ArcGIS Pro.

Leave a Comment

Your email address will not be published. Required fields are marked *