Is it possible to run Python 3 scripts on our ArcGIS Server 10.5 running windows? Basically, 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 here that Python 3 is installed with Pro on the desktop but can't see advice on how to install on your server?

I see this documentation here but the Windows option is greyed out.

  • ArcGIS Pro uses Python 3, ArcGIS Desktop and ArcGIS Server use Python 2.7. You can run the code on the server (you can have both Python 2.x and 3.x installed at the same time) but I'm fairly confident ArcGIS Server 10.5 will not run ArcGIS Pro code as Server will only run Python 2.7. – Midavalo Jan 15 '18 at 15:54
  • Will it become possible later? If ESRI are using Python 3 with Pro, then I thought you would be able Share a geoprocessing service that contains Python 3 on to your server? – badgerseatfrogs Jan 15 '18 at 16:13
  • Unlikely with the 10.x releases of Server. You may want to look at one of the Esri release road-maps as they will outline what is coming in the future. If it does happen (that Server supports Python 3), I believe it will come with it no longer supporting 2.x. – Midavalo Jan 15 '18 at 16:15
  • 3
    Server 10.5 does have an internal version of Python3. This is how it can support geoprocessing services (web tools) created from ArcGIS Pro. I dont have a copy of Server 10.5 in front of me to drill down, but its somewhere deep deep down, like C:\Program Files\Server\Framework\ ... down down \ ..similar path to Python you see in Pro – KHibma Jan 15 '18 at 18:04
  • 2
    Keep in mind, I'm not sure your mileage on directly using that Python. Its there only in support of Server. It's not put there as a mechanism to tap directly into. (though I'm pretty sure it'll work just fine) – KHibma Jan 15 '18 at 18:09

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

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.