Installing Python Packages to FME Desktop

There may be times when a Python script may require the use of Python packages not included with FME. There are two types of Python packages:

  • Universal packages that only contain .py files that work with different versions of Python.
  • Non-universal packages that contain files that are tied to specific versions of Python. Generally these packages contain binaries such as .pyd or .dll files.

Because FME ships the pip package management system with its Python interpreter, it is possible to install these Python packages for use in FME using pip.

To invoke pip to install a Python package

Run the following command:

  • Windows: fme.exe python -m pip install <package_name> --target <package_destination_folder>
  • Linux: ./fme python -m pip install <package_name> --system --target <package_destination_folder>
  • macOS: ./fme python -m pip install <package_name> --target <package_destination_folder>

<package_name> is the name of the Python package to install.

<package_destination_folder> is the folder in which to install the Python package . For "universal" packages, the destination folder should be:

  • Windows: C:\Users\<user>\Documents\FME\Plugins\Python
  • Linux: ~/.fme/Plugins/Python
  • macOS: ~/Library/Application\ Support/FME/Plugins/Python

For example, to install the "six" Python Compatibility Library:

  • Windows: fme.exe python -m pip install six --target C:\Users\<user>\Documents\FME\Plugins\Python
  • Linux: ./fme python -m pip install six --system --target ~/.fme/Plugins/Python
  • macOS: ./fme python -m pip install six --target ~/Library/Application\ Support/FME/Plugins/Python

For "non-universal" packages, the destination folder should be:

  • Windows: C:\Users\<user>\Documents\FME\Plugins\Python\python<major><minor>
  • Linux: ~/.fme/Plugins/Python/python<major><minor>
  • macOS: ~/Library/Application\ Support/FME/Plugins/Python/python<major><minor>

For example, to install the NumPy package for Python 3.7:

  • Windows: fme.exe python -m pip install numpy --target C:\Users\<user>\Documents\FME\Plugins\Python\python37
  • Linux: ./fme python -m pip install numpy --system --target ~/.fme/Plugins/Python/python37
  • macOS: ./fme python -m pip install numpy --target ~/Library/Application\ Support/FME/Plugins/Python/python37

Note:  

Substitute <user> with the Windows user name.

Depending on Linux distribution, --system may either be required or must be excluded.

For "non-universal" packages, the Python interpreter used should match the major and minor versions being specified. The Python interpreter loaded is determined by the Preferred Python Interpreter setting.