AttributeError: 'GIS' object has no attribute 'admin' [Only in stand alone script]!!

09-26-2022 11:04 AM
Occasional Contributor III

the following code produces the error: AttributeError: 'GIS' object has no attribute 'admin' but only in a stand alone script executed from the command line. The identical code works fine in Jupyter lab as well as the Python window in Pro.

Trimmed down the code in case anyone wants to attempt to replicate on their end.



#Import Modules
from arcgis.gis import GIS

##Log into Enterprise
gis1 = GIS("", username = "", password = "password", verify_cert=False) 
print("Logged in as: " +

#Create server object
server1 = gis_servers[0]



Fails at line 9.

The user is an administrator.

Additional Details:

  • ArcGIS Pro 3.0.2 using a cloned environment
  • ArcGIS API version 2.0.1
  • Behavior is the same whether I run via python.exe or propy.bat
  • I use stand alone scripts along with task scheduler all the time
  • Modifications to the OS System Environment Variables does not fix this

Other Observations (potential red herring though): This has all been ruled out as I can reproduce in multiple environments (completely different devices/workstations).

  • setting the 'path' system variable to the current cloned environment location and then typing 'python' in PowerShell yields the following warning: ZacharyHart_0-1664217924116.png

    but lists the correct version of the arcgis module. The same AttributeError is returned in this configuration.

  • The same Attribute Error is returned if the path system variable is set to the default Python environment as well.
  • Switching the environments in ArcGIS Pro does not change the results.
  • using the ProPy.bat from PowerShell does launch a Python command line without the activation warning shown above.
0 Kudos
7 Replies
Occasional Contributor III

I trimmed down the code significantly should anyone want to try to reproduce.

I have also reproduced with with a built-in admin account as well as a domain user account with the Admin role in Enterprise. I have reproduced this from multiple environments.

0 Kudos
Occasional Contributor III

Another update: I modified the script to also include:

import arcgis
print("arcgis API is version {0}".format(arcgis.__version__))

So I can confirm that no matter how the script is called, the correct/latest version of the arcgis API is indeed being used.

0 Kudos
MVP Frequent Contributor

I get a different error myself, doesn't matter if I do stand alone with IDLE or notebook in Pro.

If I run it with Pro 2.9.3 with IDLE 3.7.11 (which reports "arcgis API is version 1.9.1") it says "'AGOLAdminManager' object has no attribute 'servers'"

If I run it with Pro 3.0.1, with IDLE 3.9.11 and reports "arcgis API is version 2.0.1" it runs fine and gives me a list of servers.

Default install environment, no clones.


Occasional Contributor III

I should probably add a few points for clarity:

  • We have a federated ArcGIS Enterprise deployment
  • In my case, by stand-alone script I mean running from a command prompt/PowerShell session.
  • I have tried this with both base & cloned conda environments.

It's entirely possible the servers module was different at 1.9.1.

Could you try running from the command line (referencing the most recent API)? That's the key difference here (as far as all my testing has shown).


0 Kudos
Occasional Contributor II

Had the same error message, it turned out admin module has more dependencies and some were missing (in my case pandas). Try putting:

import arcgis.gis.admin

in standalone script, and see what happens (I got as below, and installing pandas solved the problem)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Miniconda3\lib\site-packages\arcgis\gis\admin\", line 9, in <module>
    from .portaladmin import PortalAdminManager
  File "C:\Miniconda3\lib\site-packages\arcgis\gis\admin\", line 10, in <module>
    from ...apps.tracker._location_tracking import LocationTrackingManager
  File "C:\Miniconda3\lib\site-packages\arcgis\apps\", line 4, in <module>
    from . import survey123
  File "C:\Miniconda3\lib\site-packages\arcgis\apps\survey123\", line 3, in <module>
    from ._survey import SurveyManager, Survey
  File "C:\Miniconda3\lib\site-packages\arcgis\apps\survey123\", line 10, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'


0 Kudos
New Contributor III
import arcgis.gis.admin

I already had this in my script and It still tells me

AttributeError: 'GIS' object has no attribute 'admin'

Same issue as @ZacharyHart here. Federated server, SAML one identity login, tells me im logged in as an org_admin and cant access server list.

0 Kudos
New Contributor III

For the record ESRI Support told me that the issue is likely because our version of Enterprise was running 10.6

0 Kudos