You are here: Administrator's Guide > Other Common Tasks > Licensing and Administration > Configuring the FME Engine > Using Python with FME Server

Using Python with FME Server

If you run workspaces from FME Server that reference Python, the FME Engines must know which Python interpreter to use. For workspaces built with FME Desktop 2016 or later, the interpreter is determined by the setting of the Python Compatibility workspace parameter. For workspaces built with previous versions of FME Desktop, the interpreter is determined by the Preferred Python Interpreter setting (under Tools > FME Options > Translation).

Using Additional Python Modules

If you need to reference a Python module from FME Server that is not part of the Python standard library, follow these steps to: 1) Obtain the module (if you have not already); and 2) Upload the module.

Obtaining the Python Module

Follow these steps if you do no already have the Python module you want to reference.

  1. To run a Python module, you must reference your own Python interpreter. If you do not have a Python interpreter installed, install one for the applicable version—either Python 2.7 or Python 3.x—from https://www.python.org/downloads/.
  2. If you installed a Python 2.7 interpreter, you must also install the the pip package management system. (The pip module is included with Python 3.x interpreters.)
    1. To get pip, securely download the contents of https://bootstrap.pypa.io/get-pip.py.
    2. From a command prompt, navigate to the directory to which get-pip.py was downloaded.
    3. Run the command:
    4. > python get-pip.py

  3. Install the package with the following command:
  4. > python -m pip install <package_name> --target C:\Users\<user>\Documents\FME\Plugins\Python

    For example, to install a package named PyExecJS:

    > python -m pip install PyExecJS --target C:\Users\<user>\Documents\FME\Plugins\Python

    Note: Substitute <user> with the Windows user name.

  5. From the C:\Users\<user>\Documents\FME\Plugins\Python directory, locate any *.pyc files and the sub-directory that contains the init.pyc and main.pyc files of your package. These files make up the Python module.

Uploading the Python Module

Use the Upload tool on the Resources page of the Web User Interface, and upload it to the folder under Engine\Plugins\python that corresponds to the Python release compatible with the module (for example, python27).

Changing the Python Interpreter

For workspaces built with FME Desktop 2016 or later, the Python interpreter you want the FME Engines to use must be specified in the workspace, according to the Python Compatibility workspace parameter.

If you have workspaces built in earlier versions of FME Desktop, and you need these workspaces to reference a different Python interpreter than the default version 2.7, follow this procedure:

Windows

Open a command prompt, specifying Run as administrator, and run the following commands:

<FMEServerDir>Server/fme/fme.exe APPLY_SETTINGS SYSTEM "Python/Use Custom Python" true

<FMEServerDir>Server/fme/fme.exe APPLY_SETTINGS SYSTEM "Python/Python Interpreter" c:/<path_to_dll>/python27.dll

Note: For information on how to locate Python dll's (<path_to_dll>), see Choosing a different Python Interpreter in the FME Knowledge Center.

Linux

Open a command prompt and run the following commands:

<FMEServerDir>Server/fme/fme APPLY_SETTINGS SYSTEM "Python/Use Custom Python" true

<FMEServerDir>Server/fme/fme APPLY_SETTINGS SYSTEM "Python/Python Interpreter" /<path>/libpython2.7.so