Geoprocessing Service - arcpy permission denied

1356
6
08-12-2021 06:08 AM
TorbjørnDalløkken2
Occasional Contributor

I've created a pythonscript  which I've published as a geoprocessing service. The script contains several third party modules (azure, pyodbc). When I try to run the service, it fails as soon as the arcpy-module is being initialized. 

Traceback (most recent call last):
File "C:\arcgisserver\directories\arcgissystem\arcgisinput\PipeRenewal_Deployment.GPServer\extracted\p20\production\Deployment.py", line 1, in <module> import arcpy
File "c:\program files\arcgis\server\framework\runtime\arcgis\Resources\arcpy\arcpy\__init__.py", line 21, in <module> import numpy
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 780, in get_code
File "<frozen importlib._bootstrap_external>", line 832, in get_data
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\ArcGIS\\Server\\framework\\runtime\\ArcGIS\\bin\\Python\\envs\\arcgispro-py3\\Lib\\site-packages\\numpy\\__init__.py'

Does anyone know what might be causing this error? I can't see any difference in folder permissions for the numpy-folder.

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

Are you running ArcGIS Server with the same Windows account you specified during installation or have you changed it since install?

0 Kudos
TorbjørnDalløkken2
Occasional Contributor

ArcGIS Server is running with the same Windows account specified during installation. I tried adding some new modules to arcgispro-py3,  which is the environment ArcGIS Server uses. Might that be causing the problem?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Did you use the same Windows account to add new modules or was it a different account than what runs Server?

0 Kudos
TorbjørnDalløkken2
Occasional Contributor

I used another account when adding the new modules. The user running ArcGIS Server doesn't have administrator-priviliges on the server.

0 Kudos
LSaunders
New Contributor III

Did you ever solve this?  I'm seeing the same issue.

0 Kudos
TorbjørnDalløkken2
Occasional Contributor

Hi @LSaunders.

Yes, I did solve the issue some time ago. As far as I remember, I solved this by copying the arcgispro-py3 environment from another machine and adding it to the environments (with a new name) on the machine where this error occurs. You need to be sure that you sign into the ArcGIS Server machine as the ArcGIS Server Account, as mentioned here https://enterprise.arcgis.com/en/server/latest/publish-services/windows/deploying-custom-python-pack...

I think that not using the correct user, might be one of the reasons I got the error in the first place.

0 Kudos