Run PyScripter with ArcGIS Pro's Python 3.x and the ArcGIS API for Python

4558
7
04-27-2017 12:17 PM

Run PyScripter with ArcGIS Pro's Python 3.x and the ArcGIS API for Python

This document will show you how you can setup PyScripter to run ArcGIS Pro's Python 3.x version and the ArcGIS API for Python

Note:  the easiest way to install the ArcGIS API for Python is to install ArcGIS Pro.  ArcGIS Pro 1.4 and later gives you a Python Package Manager interface that can be used to download and install the ArcGIS API for Python.  See the following link for more details on how to install the API:

Install and set up | ArcGIS for Developers 

On the server where ArcGIS Pro is installed, follow the below steps to utilize it with PyScripter:

1.  Download and install the 64-bit version of PyScripter

2.  Open PyScripter and click View > Toolbars > View Toolbar:

3.  On the View Toolbar, click the Python Versions tool (first icon):

4.  Select the option Setup Python Versions

5.  Select the green + (Add a new Python version)

6.  Browse to the directory where the python.exe for ArcGIS Pro resides.  Ex:

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe

4. Click OK

5. The Conda 3.x should be listed under Unregistered Versions:

6.  To switch to Conda 3.x, click the Python Versions tool and select the newly added version:

You have the ability to easily switch back and forth between environments.

As a test, you can use the following snippet to test the new python environment is working successfully:

from arcgis.gis import GIS

gis = GIS() # anonymous connection to www.arcgis.com

# Search for 'USA major cities' feature layer collection
search_results = gis.content.search('title: USA Major Cities and owner:esri','Feature Layer')

# Access the first Item that's returned
major_cities_item = search_results[0]

print(major_cities_item)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Comments

Can you also post something for PyCharm?

Roy SP‌ take a look at the bottom of this document for PyCharm:

https://community.esri.com/docs/DOC-8359 

Great, Thank you!

How would I do this if I wanted to set up a scheduled task that worked with the external run?

gisadmin CPG‌ you could run this as a .bat file on a machine that has ArcGIS Pro installed.  For example, you can access 64-bit python from the following location on a server that has Pro installed:

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3

You could set up your .bat file like the following:

cd C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3

python <path to script>\Script.py

Then have Windows Task Scheduler execute the .bat file

FYI,

I stumbled across this post and failed to get pyscripter working with ArcPro python. It is because I have installed the 32 bit version of pyscripter. I felt it worth mentioning for others. One must have the 64 bit version of pyscripter installed to be able to use the ArcPro python. Still this was a really helpful document, thanks!

Thanks, Duncan Hornby‌.  I went ahead and updated the document stating you will need to download the 64-bit version of PyScripter.

Version history
Revision #:
1 of 1
Last update:
‎04-27-2017 12:17 PM
Updated by:
 
Contributors