Skip To Content

Deploying custom Python packages for ArcGIS Server

ArcGIS Server includes Python 2.7 for Windows 64 bit. At ArcGIS Enterprise 10.5 and later, a Python 3-based conda environment is included with ArcGIS Server.

The Python installation of ArcGIS Server includes packages such as numpy and matplotlib. However, if you want to install additional custom Python packages, follow the steps below.

Services published from ArcGIS Pro

For geoprocessing services published from ArcGIS Pro or the arcpy module based on your ArcGIS Pro conda environment, third-party Python packages cannot be deployed on your Linux server.

Services published from ArcGIS Desktop

Follow these steps for geoprocessing services published from ArcMap and the arcpy module based on Python 2.7. Repeat the steps on each machine in your ArcGIS Server site. The package will be installed to the server's default Python 2.7 and will apply to all services published from ArcGIS Desktop.

  1. Download a Windows 64-bit version of the package you want to install.
  2. Start the wine explorer application. At the terminal, paste this command:

    . <ArcGISServer_InstallDir>/arcgis/server/framework/etc/arcenv; wine explorer &

  3. Browse to your download location (remember that Z:\ is mapped to your system's /).
  4. Double-click the .msi or .exe file to install the package.

Custom packages are typically installed in the <ArcGISServer_InstallDir>/arcgis/server/framework/runtime/.wine/drive_c/Python27/ArcGISx6410.8/lib/site-packages directory.

Test custom Python packages for services published from ArcGIS Desktop

To test that the package installed properly, write a Python script that imports the package you installed, and run the script. If you are unfamiliar with running stand-alone scripts, follow the steps below.

  1. Open the terminal window.
  2. Run the server's Python 2.7 with the script as an argument, for example, <ArcGISServer_InstallDir>/arcgis/server/tools/python ~/projectX/mytestscript.py.

Note:

The Python libraries installed by an ArcGIS Server (Linux) installation are Windows 64-bit Python. Therefore, you should always use the Windows path separator (\) for stand-alone Python scripts when accessing data and other Python modules. Also, be aware that there is a Z:\ directory that is mapped to the Linux system's /. In a Python script, you can access data and other Python modules using Z:\ mapping. For example, data in /myuser/myproject/data can be accessed using z:\myuser\myproject\data.

This does not apply to Python scripts you publish from ArcGIS Desktop, because that publishing process converts all paths to the correct format.