[GIS] Run Python 3 scripts on ArcGIS Server 10.5

arcgis-proarcgis-serverarcpypython 3

Is it possible to run Python 3 scripts on our ArcGIS Server 10.5 running Windows?

I have a script that I want to publish as a geoprocessing tool that exports an .aprx (ArcGIS Pro) file to a PDF using arcpy.mp but this is using Python 3.

I see at Run stand-alone scripts that Python 3 is installed with Pro on the desktop but can't see advice on how to install on your server.

I see The Python 3 runtime for ArcGIS Server on Linux but the Windows option is greyed out.

Best Answer

Set PYTHONPATH to the location of the Python3 libraries. I found these in ServerRuntime.pth.

I tried this on ArcGIS Server 10.5.1, I suspect the Python3 arcpy will match ArcGIS Pro at that point in time.

set PYTHONPATH=C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy;C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcToolBox\Scripts;C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin
cd C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\a
rcgispro-py3
python.exe

Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v
.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>>
Related Question