Select to view content in your preferred language

How to Use Previous Version of ArcGIS API for Python

1705
11
09-10-2024 02:15 PM
Map12
by
Emerging Contributor

Is it possible to use a previous version of the ArcGIS API for Python without reverting ArcGIS Pro to a previous version?

I have a script that works great with the ArcGIS Pro 3.0 conda environment. Once I upgraded to ArcGIS Pro 3.3 it no longer works. Specifically here is the code and error below:

AttributeError: 'Server' object has no attribute 'services'

from arcgis.gis.server import Server
gis_server = Server(url=f"{server_base_url}/arcgis/admin",
                  token_url=f"{server_base_url}/arcgis/tokens/generateToken",
                  username=username,
                  password=password)
folder_list = gis_server.services.folders

Again, this works fine in Pro 3.0 but not 3.3.

I also use VScode to run scripts. I have tried exporting the 3.0 conda environment as a .yml file and bringing it into my new machine to no avail.

Also the package manager in Pro does not allow you to change versions of arcgis (the package for ArcGIS API for Python).

My script needs arcpy so I don't believe I could create a new blank virtual environment and add the packages I need.

 

11 Replies
Map12
by
Emerging Contributor

Hi @chris_del101 ,

No, I haven't found a solution for this. I've had to keep older versions of Pro installed in order to run some of the scripts I have. Of course, the long-term solution is to get upgraded so Server and Pro are at compatible versions.

0 Kudos
chris_del101
Regular Contributor

I actually require two versions of the api, 2.1.0 and 2.4.0 (or whatever newest is - this is the newest now). I want to run these in Pro and not just using the Pro conda environments outside of Pro (which is possible and easier). I guess my comments are only somewhat related to what you are trying to do. 

I'm not asking my own question as I think I already know the answer to my question: it's not possible.

0 Kudos