What is a Python Interpreter?

An interpreter is a library which enables you to run Python scripts. This may also be referred to as a Python installation. FME installs its own Python interpreter, but you may wish to use a different one.

Why would I want to choose a different Python Interpreter?

There are various reasons you might choose a different Python interpreter:
  • When creating a Python script for use with both FME and ArcGIS (for example) you could point FME to use the Python Interpreter installed by ArcGIS, to ensure both applications work.
  • When you want to integrate FME with a 3rd-party Python package, installing them with an independent Python Interpreter ensures you won't have to reinstall those packages if you upgrade your version of FME
  • When you need to run a script in a different version of Python to that which FME installs, you will need to install that version separately and direct FME to use it. For example, FME (currently) uses Python v2.7. Integrating FME with 3rd-party Python modules that only work under Python v2.6 would require the installation and use of a v2.6 interpreter.

Installing Python for FME

If you are installing python for use with FME Server you should choose the "Install for all users" option in the python installer, other wise we recommend you use the option "Install just for me".

Also note that you will not be able to use 64-bit Python through a 32-bit version of FME, or vice versa.

Where do I find the Python DLL?

It depends on how you installed Python, and what your OS is.

If you installed 32-bit Python "for all users" on a 32-bit computer, it will be in c:\Windows\System32
If you installed 32-bit Python "for all users" on a 64-bit computer, it will be in c:\Windows\SysWOW64
If you installed 64-bit Python "for all users" on a 64-bit computer, it will be in c:\Windows\System32 (I know, me neither).

If you installed Python "just for me", it will be in the Python installation folder, for example c:\Python26

For FME Desktop

Selecting a Python Interpreter with FME Desktop 2012 or later

To choose a different Python interpreter for FME requires you to select that Interpreter's DLL file. In FME 2012 and later the procedure is as follows:
  • Select Tools > FME Options from the menubar
  • Select the tab for "Runtime"
  • Check the box labelled "Use Custom Python Interpreter"
  • Select the location of the Python DLL you wish to use

User-added image

NOTE: This option controls FME as a whole, and not just the current workspace. Therefore, all FME processes will use this alternative version of Python, until you revert this option.

Selecting a Python Interpreter with FME 2011 or earlier

FME version 2011 (and earlier) did not have the Python Interpreter option. Therefore the procedure is more complex.

Either:
  • In the Edit Header dialog of FME Workbench, add the line 'FME_PYTHON_VERSION 2.x' (where x is between 3 and 7 inclusive).
Or:
  • Set the environment variable FME_PYTHON_VERSION to 2.x (where x is between 3 and 7 inclusive).

Known Issues

In doing this for 2011, there are known concerns or issues:
  • When these methods are used, FME will overlook its own built-in interpreter, even if the versions match
  • These methods will work in FME 2012 and later, but will be overridden by the Python Interpreter option (if set)
  • FME will choose the first Python interpreter in the PATH environment variable that matches the specified version, so selecting a specific interpreter (for example the ArcGIS one) requires that to have priority
  • Be aware that installing another product that includes Python could change the PATH setting and break your configuration

For FME Server

Selecting a Python Interpreter for FME Server / FME Engine 2012

Option #1 for FME Server 2012

To use this option you will need to change the user running the FME Server Windows Service to the same user you are logged in as. To this go to the Windows Services Panel and right click on the FME Server service to get the properties window. In the service properties window click Log On tab and change the user and password to be the same user as you are currently logged in as.  Restart the FME Server service.

Now you can use a command line interface for FME Engine to change the Python interpreter. This does the same thing as the setting in FME Workbench used in FME Desktop.

Open a command window and navigate to your FME Engine directory:
<FMEServer>\Server\fme

From the command prompt enter these two commands but replace <pythonpath> with full path to the python dll you want to use:
1. fme APPLY_SETTINGS "Python/Use Custom Python" true
2. fme APPLY_SETTINGS "Python/Python Interpreter" <pythonpath>

for example

fme APPLY_SETTINGS "Python/Python Interpreter" "C:/fmepython27"
This should be done on each computer running an FME Engine. 

The setting can be disabled by running:
fme APPLY_SETTINGS "Python/Use Custom Python" false

Option #2 for FME Server 2012

If for some reason you cannot change the user running the FME Server Windows service to the user you are logged in as it is also possible to redefine the Python Interpreter to use for the FME Engine by creating two registry entries.

The are two .reg files attached one for 32 bit and one for 64 bit FME.  Chose the appropriate file and edit the path to the python interpreter to reflect the path that you want to use.  You can then add the registry key by double clicking on the file.

Selecting a Python Interpreter for FME Server 2013 or later

In FME Server 2013 a command line interface can be used to add the registry entries regardless of the user running the FME Server Windows service.  Again open a command window and navigate to your FME Engine directory:
<FMEServer>\Server\fme

From the command prompt enter these two commands but replace <pythonpath> with full path to the python dll you want to use:

1. fme APPLY_SETTINGS SYSTEM "Python/Use Custom Python" true

2. fme APPLY_SETTINGS SYSTEM "Python/Python Interpreter" <pythonpath>

Or you can use the two .reg files attached - one for 32 bit and one for 64 bit FME.  Chose the appropriate file and edit the path to the python interpreter to reflect the path that you want to use.  You can then add the registry key by double clicking on the file.

Are there any problems with changing the Python interpreter?

  • The ArcGIS 10 Desktop installer also puts its Python DLL into the windows folder, therefore if you install a different version of Python with "for all users", you may inadvertently overwrite this part of the ArcGIS installation.
  • If you choose to install python using the option "Install just for me" then FME Server will not be able to use this python unless you were logged in as the user who is running the FME Server Service.