Importing arcpy fails with ArcGIS Engine Runtime for Linux

3835
4
06-03-2013 01:31 PM
JasonGreenlaw
Occasional Contributor
I have an ArcGIS Engine Runtime 10.1 SP1 for Linux installation on RHEL 6 x86_64, and while I am able to run Java ArcObjects code without problems, I cannot seem to get arcpy to import using the packaged python interpreter.

My $DISPLAY variable is set correctly and I believe I am sourcing the required files ($ENGINE_HOME/vmw/setenv_mw.sh and $ENGINE_HOME/python27/setenv_python.sh).  I'm using the python interpreter packaged with arcpy:  $ENGINE_HOME/python27/bin/python.  I have all the required packages installed (the ones listed under the "Linux" link at the bottom of this page: http://resources.arcgis.com/en/help/system-requirements/10.1/index.html#//015100000068000000).

Here is the output:

[arcengine@nimbus engine10.1]$ ./python27/bin/python
Python 2.7.2 (default, Feb 23 2012, 12:21:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/__init__.py", line 21, in <module>
    from arcpy.geoprocessing import gp
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/geoprocessing/__init__.py", line 14, in <module>
    from _base import *
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/geoprocessing/_base.py", line 592, in <module>
    env = GPEnvironments(gp)
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/geoprocessing/_base.py", line 589, in GPEnvironments
    return GPEnvironment(geoprocessor)
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/geoprocessing/_base.py", line 545, in __init__
    self._refresh()
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcpy/geoprocessing/_base.py", line 547, in _refresh
    envset = (set(env for env in self._gp.listEnvironments()))
RuntimeError: NotInitialized


Importing arcpy works fine for ArcGIS Server 10.1 for Linux, but I can't get it to work for Engine.

Has anyone gotten arcpy to import properly in Linux ArcGIS Engine Runtime 10.1? 

Thanks
Jason
Tags (2)
0 Kudos
4 Replies
KevinHibma
Esri Regular Contributor
Can you do an "import arcengine" first - does that work?
0 Kudos
JasonGreenlaw
Occasional Contributor
No, that also seems to fail, but with Error 999999:

[arcengine@nimbus engine10.1]$ ./python27/bin/python
Python 2.7.2 (default, Feb 23 2012, 12:21:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcengine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/esri/arcgis/engine10.1/python27/lib/python2.7/site-packages/arcpy/arcengine.py", line 18, in <module>
    gp.setProduct("Engine")
RuntimeError: ERROR 999999: Error executing function.
>>>


The same error also appears of I try to "import arcview" or "import arcinfo".
0 Kudos
BrentLund
New Contributor

Was this problem ever resolved?   I am experiencing similar issues

0 Kudos
GriffinMorgan1
Esri Contributor

Brent Lund​ I believe you need to source $ENGINE_HOME/init_engine.sh. It will then take care of sourcing $ENGINE_HOME/vmw/setenv_mw.sh and $ENGINE_HOME/python27/setenv_python.sh after setting additional environment variables.

0 Kudos