what version does ArcGIS Server use regarding arcpy/Pro/Map ?

465
5
01-12-2021 07:29 PM
AdamArcichowski
New Contributor III

Hello could someone explain this to me or point me to a documentation please. I'm not even sure if I am asking the question correctly. Hope the explanation makes sense. 

So I published the result from my Script (Geoprocessing tools) in Pro 2.5. The script is in Python 3.x. The web tool (geo-processing tool) works as expected in Portal by users on  ArcGIS Server. 

My questions are. 

1. What license does the Geoprocessing tool use on the ArcGIS Server to open up Pro. Or does it just use the arcpy library and it does it without even needing a license ? 

2. What version does it use of Pro? Can I update the version ?  how does this work ? 

I'm asking these questions because my co-workers recently updated to ArcPro 2.7 and when they run the script on their computer it fails because (like always....) things break when updating. So now that I fixed the script for Pro 2.7 when I publish to the ArcServer, will it fail on the Server now when users try to use that webtool because it is for Pro 2.7 and the Server is on whatever it is ? 

I just would like to have an understanding on how this works. 

Thanks!  

5 Replies
CalvinLietz
Esri Contributor

Hi Adam,

  1. If you run a geoprocessing service published to ArcGIS Server, it uses Python libraries that come pre-installed with the ArcGIS Server installation, not anything from ArcGIS Pro. Additionally, it uses licenses assigned to the ArcGIS Server site, not a license configured with ArcGIS Pro or any other desktop client. Take a look at the functionality matrix for more information.
  2. You can find the version of Python used by ArcGIS Pro from Settings -> Python in the ArcGIS Pro interface. The Python Package Manager lists the versions of all packages currently installed in your environment. The Python version matrix for ArcGIS Desktop and ArcGIS Server can be found here.

Hope this helps!

-Calvin

AdamArcichowski
New Contributor III

Thanks for the reply Calvin. 

I understand the concept a bit better. 

However, I'm still a bit confused. So when I upgrade my Pro on my desktop (from 2.4 to 2.7) I assume, it installs the new version of  Python libraries. So does that mean I have to upgrade the Python Library where the ArcServer is installed. I'm assuming it is an older version of the python libraries because my scripts work on it from 2.4. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

ArcGIS Enterprise/Server Python libraries get installed and updated by Esri, not by users.  Although it is technically possible to update Python packages (not the Python version itself) manually on the server, it isn't supported and there is a likelihood some functionality of the Esri product may break.

Getting back to your script on Pro, Esri puts a lot of emphasis on backwards and forwards compatibility of geoprocessing tools.  Given that Pro 2.4 and Pro 2.7 both are Python 3.x, I am surprised to see a script that ran on 2.4 break on 2.7.   What exactly broke?

In terms of geoprocessing service, a service on the server is completely self contained and does not use any of the binaries or libraries on the Pro client consuming the service.

AdamArcichowski
New Contributor III

I see. This is making more sense now. 
It seems like the way ths .isWebLayer method on a layer object works is different in 2.4 vs 2.6+ 

Below is the code for 2.4 . 

#create an array with the webservice names coming from the WebmapJson
webLyrsArr = []
for lyr in map.listLayers():
    if lyr.isWebLayer:
        webLyrsArr.append(lyr.name)
        arcpy.AddMessage(webLyrsArr)

I had to change the code below to get it to work on 2.6+

#create an array with the webservice names coming from the WebmapJson
webLyrsArr = []
for lyr in map.listLayers():
    arcpy.AddMessage(lyr.name)
    if lyr.isWebLayer:
        #for Arcgis Pro 2.6+ you have to loop again
        for lyrs2 in lyr.listLayers():
            webLyrsArr.append(lyrs2.name)

 

I believe it has something to do with grouping layers. When I bring in a mapserver in 2.4 the code works and lists every layer in the mapserver. However, if I try to do that with 2.6 it only adds the Group Name of the layer to the append list, not the layer names inside the group name. I have to do another for loop inside the group to get the layer names. But this does not work in Pro 2.4. 

I'm going to try and publish to the Server with the working 2.6 script. I will update when I find out. 

 

0 Kudos
AdamArcichowski
New Contributor III

 

@JoshuaBixby So yeah as I expected the script works on Pro 2.7 after changing the script a bit but when I publish the tool, it fails on the Server. On the exact line where I made it work for Pro 2.6 +. I will look into another way of doing this I guess. 

Why do the python libraries get updated on Pro but can't on Server ?

I have a few other scripts that break after upgrading to 2.6 but work on 2.4. Theses ones I don't publish to the Server but I suspect that they would not work on Server because of the recent changes in python libraries in 2.6+

0 Kudos