Select to view content in your preferred language

Remote arcpy import issues

3820
1
03-19-2016 09:08 AM
Gavinmontgomery
Deactivated User

Hi All,

We are trying to implement remote instantiation of a python application that uses arcpy. The scripts work perfectly fine when running on the virtual machine when logged in as a user. However when using Ansible and TeamCity the script will no longer allow the import of arcpy. Attempting to add arcinfo also creates problems.

Other things of note, I have confirmed that the PYTHONPATH's are configured correctly and that the output for the active user is also the same when running locally or remotely.

I have done a license check and this also reports to have arcInfo "Available"

Any advice appreciated

Importing ArcInfo

        # C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcinfo.pyc matches C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcinfo.py

    [15:38:05][Step 2/2] import arcinfo # precompiled from C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcinfo.pyc

    [15:38:05][Step 2/2] import arcgisscripting # dynamically loaded from C:\Program Files (x86)\ArcGIS\Desktop10.2\bin\arcgisscripting.pyd

    [15:38:05][Step 2/2] Traceback (most recent call last):

    [15:38:05][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\runpy.py", line 162, in _run_module_as_main

    [15:38:05][Step 2/2]     "__main__", fname, loader, pkg_name)

    [15:38:05][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\runpy.py", line 72, in _run_code

    [15:38:05][Step 2/2]     exec code in run_globals

    [15:38:05][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\site-packages\end_to_end_inspections\out\test.py", line 10, in <module>

    [15:38:05][Step 2/2]     import arcinfo

    [15:38:05][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcinfo.py", line 18, in <module>

    [15:38:05][Step 2/2]     gp.setProduct("ArcInfo")

    [15:38:05][Step 2/2] RuntimeError: ERROR 999999: Error executing function.

Importing arcpy:

    # C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.pyc matches C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py

    [15:26:38][Step 2/2] import arcpy.geoprocessing._base # precompiled from C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.pyc

    [15:26:38][Step 2/2] Traceback (most recent call last):

    [15:26:38][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\runpy.py", line 162, in _run_module_as_main

    [15:26:38][Step 2/2]     "__main__", fname, loader, pkg_name)

    [15:26:38][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\runpy.py", line 72, in _run_code

    [15:26:38][Step 2/2]     exec code in run_globals

    [15:26:38][Step 2/2]   File "C:\Python27\ArcGIS10.2\lib\site-packages\end_to_end_inspections\out\test.py", line 11, in <module>

    [15:26:38][Step 2/2]     import arcpy.toolbox

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 21, in <module>

    [15:26:38][Step 2/2]     from arcpy.geoprocessing import gp

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>

    [15:26:38][Step 2/2]     from _base import *

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 592, in <module>

    [15:26:38][Step 2/2]     env = GPEnvironments(gp)

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 589, in GPEnvironments

    [15:26:38][Step 2/2]     return GPEnvironment(geoprocessor)

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 545, in __init__

    [15:26:38][Step 2/2]     self._refresh()

    [15:26:38][Step 2/2]   File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 547, in _refresh

    [15:26:38][Step 2/2]     envset = (set(env for env in self._gp.listEnvironments()))

    [15:26:38][Step 2/2] RuntimeError: NotInitialized

0 Kudos
1 Reply
RobinGeorge1
Deactivated User

Hi Gavin...did you ever get this resolved as I having a similar issue with importing arcpy? Thanks.

0 Kudos