Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ArcGIS Linux runs arcpy using wine [1]. Python is a simple wrapper in bash.

...

  1. /arcgis/server/tools/python

    Code Block
    >>import arcpy, os
    >> sdList = os.listdir('c:/')
    >> print sdList
    ['Program Files', 'Program Files (x86)', 'ProgramData', 'Python27', 'users', 'windows



Python3 via Wine cmd

See [2] for running conda like Windows environment.

  1. $. /arcgis/server/framework/etc/arcenv
  2. $wine cmd
  3. cd c:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts
  4. conda create --clone arcgispro-py3 --prefix "Z:\home\arcgis\bin\Python\envs\test"
  5. proswap Z:\home\arcgis\bin\Python\envs\test
  6. conda install pyarrow

    1. This will install packages under Z:\home\arcgis\bin\Python\envs\test
  7. Run python and test import.

    Code Block
    Z:\home\arcgis\bin\Python\envs\test>python
    python
    Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (\
    AMD64)] on win32
    
    Warning:
    This Python interpreter is in a conda environment, but the environment has
    not been activated. Libraries may fail to load.  To activate this environment
    please see https://conda.io/activation
    
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyarrow


Python3 via Wine only

  1. Set up path for wine.

    Code Block
    languagebash
    $. /arcgis/server/framework/etc/arcenv
  2. Execute python3 under wine.

    Code Block
    languagebash
    $wine /arcgis/server/framework/runtime/ArcGIS/bin/Python/envs/arcgispro-py3/python.exe
    wine ./server/framework/runtime/ArcGIS/bin/Python/Scripts/conda
     
  3. Alternatively, you can run python in custom environment.

    Code Block
    languagebash
    $wine /home/arcgis/bin/Python/envs/test/python.exe
Info
ArcGIS Python doesn't include GDAL but it has many APIs [3].

References

  1. https://www.linux.org/threads/running-windows-batch-files-on-linux.11205/
  2. https://enterprise.arcgis.com/en/server/10.3latest/publish-services/linuxwindows/deploying-custom-python-packages.htm
  3. https://wwwpro.linuxarcgis.orgcom/threadsen/running-windows-batch-files-on-linux.11205/pro-app/arcpy/classes/raster-object.htm

Content by Label
showLabelsfalse
max5
spacesSDT
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "arcpy" and type = "page" and space = "SDT"
labelsarcpy

...