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, the conda environment is included with ArcGIS Server. The conda environment is based on Python 3.

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

Note:
You will be modifying the default ArcGIS Server conda environment. In the event of environment corruption, you will need to re-install your ArcGIS Server. If you are using ArcGIS Server 10.7 or later, a safer process to deploy your Python packages is available.
  1. Log in to your ArcGIS Server machine and open the Command Prompt as an administrator.
  2. Browse to <install>\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts.
  3. Run conda install for the packages that need to be deployed. Only use pip install if conda install is not available.
  4. Restart the geoprocessing service in ArcGIS Server Manager.
  5. Optionally restart the ArcGIS Server services on the Windows Task Manager Services tab. It will take a few minutes before all services are back online.

Services published from ArcGIS Desktop

  1. Download the Windows 64-bit version of the package.
  2. Browse to your download location.
  3. Double-click the .msi or .exe file to install the package.

Custom packages typically install into the following directories: C:\Python27\ArcGISx6410.2\lib\site-packages

Testing 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 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 Linux Server installation is Windows 64-bit Python. Therefor, stand-alone Python scripts should always use the Windows path separator (\) when accessing data and other Python modules. Also, be aware that there is a Z:\ which is mapped to the Linux systems' /. Within a Python script you can access data and other Python modules using Z:\ mapping. For example, data in /myuser/myproject/data can be accessed as z:\myuser\myproject\data.

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

Related topics