Running Arcpy with a authorization code or virtual token

03-16-2022 04:19 PM
Labels (3)
New Contributor

Hello, my name is Héctor, I'm seeking a college degree. I have an ArcGIS Pro license due to my university. And I need to run an image classification routine (Support Vector Machine classification) and it's going to take a few days to analyse a whole watershed. That is why I would like to run the python code of this process on the supercomputer at my university. But the supercomputer only runs Python codes and I cannot install ArcGIS Pro. Thus, Arcpy does not work on this computer because of its software dependency on ArcGIS Pro.


Just like Google Earth Engine where you can create a key to run any code without worrying about the virtual token (Authorization process). Is there a way to run Arcpy by not installing ArcGIS Pro?


I only want a way to leave my code running on a terminal, close my laptop and wait until the analyse is done.


Please, I have been reading a lot of websites but I cannot figure out a way to deal with this. I only want to run Python code in a terminal without worrying about leaving my laptop on.


Please I need help. 

4 Replies
Occasional Contributor III

You can do it without ArcPy.


def getToken():
# Name: Function - getToken
# Purpose: Get's a authentication token from Portal.

if portal_URL[-1] == '/':
url = portal_URL + 'sharing/rest/generateToken'
referrer = portal_URL[0: -1]
url = portal_URL + '/sharing/rest/generateToken'
referrer = portal_URL

values = {'f': 'json',
'username': portal_uName,
'password': base64.b64decode(portal_pWord),
'referer' : referrer,
'expiration' : '60'}

data = urllib.parse.urlencode(values).encode("utf-8")
req = urllib.request.Request(url)

response = None
while response is None:
response = urllib.request.urlopen(req,data=data)
the_page =

#Garbage Collection with some house building
payload_json = the_page.decode('utf8')
payload_json = json.loads(payload_json)

data_token = payload_json['token']

return (data_token)

0 Kudos
Occasional Contributor III can drop the base64 stuff I have in there. Had a security by obscurity moment.

0 Kudos
Regular Contributor

arcpy is available to install from a conda package 

Occasional Contributor III

Forgot to mention, you might not want to run Python on a supercomputer as it will probably take you a bit to tweak it for optimal performance and as you are likely aware, supercomputer time is limited. I would opt to go the route of C++ if my memory is correct on what is the most common language for it to run on. Stanford has been using Regent too. 

0 Kudos