Share python tool as GP Service

431
4
03-27-2019 12:35 AM
ModyBuchbinder
Esri Regular Contributor

Hi All

When I write a python tool in Pro it uses python 3

When I share it (as service or package) the server uses python 2.

What happens if I need to use python 3 functions or libraries?

see similar question here: https://gis.stackexchange.com/questions/268056/run-python-3-scripts-on-arcgis-server-10-5 

Thanks

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

don't know since I don't work in that environment, but there are documents and there is an anaconda distribution

based on python 3

Deploying custom Python packages for ArcGIS Server—Documentation | ArcGIS Enterprise 

0 Kudos
ModyBuchbinder
Esri Regular Contributor

Hi Dan

Thanks for the answer but let me clarify my question.

I build a GP tool in Pro uses python 3 (this is what is used for pro).

It is not in anaconda it is GP tool.

Then I pack or publish it for the server.

Check this: https://support.esri.com/en/technical-article/000013224 The server use python 2 to run a tool that was written in python 3.

It is almost identical but still there is a few things in python 3 that will not work in python 2.

Thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

Sorry, I haven't used 2.7 in so long I can't remember which python modules or python functionality changed between the two ( like the obvious print, range etc)

Support for 2.7 is being dropped by a lot of things already or soon (ie numpy, scipy, pandas etc).

A specific example would help of what you are missing or what behaves differently to see if there is a simple workaround.  Anything on GitHub is pretty easy to get version different code (I do it all the time with numpy when ArcGIS distributed packages lag behind current needs or you want to support arcmap)

0 Kudos
JonathanQuinn
Esri Notable Contributor

This may only be possible on Linux, and I also don't know if it applies to geoprocessing services:

http://enterprise.arcgis.com/en/server/latest/administer/linux/linux-python.htm

0 Kudos