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

Using Python with FME Server

Configuring a Custom Python Interpreter

Windows

On Windows systems, FME installs its own Python interpreter, which is used by any scripts that run Python in FME. If you want FME to use your own custom Python interpreter, run the following commands from a command prompt:

Note: To avoid errors, the Windows Command Prompt must likely be run as administrator, even if you are currently running your machine with administrator privileges. From the Start Menu, right-click on Command Prompt and select Run as administrator.

  • <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

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

Linux

On Linux, FME uses the Python module that is installed with the system. To use your own Python module in FME, configure it with the system Python:

  • <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

Uploading Python Modules to FME Server

If you have a Python module you need to use on FME Server which is not part of the Python standard library, 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).

Uploading Python Packages

If you want to upload a Python package, rather than a stand-alone module, follow this procedure:

  1. Install the package to FME Desktop. Safe recommends using the pip package management system for this task.
    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. > fme python get-pip.py

    5. To install a package, run the following command:
    6. > 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.

  2. From the directory specified in step 1d, locate the sub-directory that contains the init.pyc and main.pyc files of your package.
  3. Use the Upload tool on the Resources page of the FME Server Web User Interface, as described above, and upload the directory containing the corresponding .pyc files of the package.