Select to view content in your preferred language

Running python using server

765
5
01-10-2024 06:20 AM
mody_buchbinder
Occasional Contributor III

I have a machine that has Pro 3.1.4 & server 11.1

When I run in CMD the python from server ("C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\arcgispro-py3\python.exe") and try to import arcpy I get an error (see attachment) When I do it with the Pro python ("C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe") it works.

Both python version are the same (3.9.16)

I have tested it on a few machines that have both Pro & server installed. Some of them works, others do not.

Opened a case but the support does not have it on his machine.

Anybody have any idea?

When using the server python we should use the server license - this is the reason to use it.

Thanks

0 Kudos
5 Replies
AllenDailey1
Occasional Contributor III

I had a similar problem a while ago.  Are you trying to use geoprocessing tools, and do you use Concurrent Use licenses for Pro?  Do you have a License Manager?  Through working with Esri, with a LOT of calls and back-and-forth, I learned that arcpy geoprocessing tools require that you're connected to the license manager in Pro.  It sounded like it's not possible to use arcpy geoprocessing tools via ArcGIS Server python... which just doesn't make any sense to me...

I don't know if any of that is relevant to your situation, but I thought I'd mention it just in case.

0 Kudos
mody_buchbinder
Occasional Contributor III

Hi Allen

Thanks for your answer.

When I use the Pro python and the Pro have any licenses it works.

Many users does not want to use Pro license for this and would like to use Server license.

In ArcMap  python you should do "import arcserver" (https://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/setproduct.htm) This does not exists in Pro arcpy.

The solution is to use the server python.exe that should use the server license automatically.

It does work on many machines but sometime does not on machines that have both Pro and Server installed.

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Can you try to run the propy.bat included with the Server installation and see if the issue reproduces there? The documentation at https://enterprise.arcgis.com/en/server/latest/develop/windows/scripting-service-publishing-with-arc... provides some additional information. You can also try running the Python 3 Command Prompt from the start group shortcut and start your Python session from that to confirm it works when activated through conda.

Cheers, Shaun

0 Kudos
mody_buchbinder
Occasional Contributor III

Hi Shaun

In most cases the reason to run server python is that we need to run python by scheduler a few times a day so the interactive mod does not help.

I tested the propy.bat at least on one machine and it did not worked. I will test it on other machines too.

Thanks 

0 Kudos
DarylHochhalter
Occasional Contributor II

I have the same issue with the same versions Python 3.9.16 Server 11.1 and Pro 3.1, works on the Pro desktop machine not when I run it via remote desktop on the server machine. The very same script from the same location. 

ERROR 000732: Input Table: does not exist or is not supported

The server is Standard the pro is advanced but this script uses arcpy.conversion.ExportTable which is available in either license.

One more thing, it was running on the server at 11.0, just upgraded to 11.1 and now doesn't run.

0 Kudos