FME Version
Files
-
- 758 Bytes
- Download
If you wish to use ArcGIS arcpy in FME, do not follow the instructions in this article and use the instructions from No Module Named ArcPy: Importing Esri's ArcPy for Use with FME article instead. More information can be found in the subsection titled Using ArcGIS's Interpreter in the Why Choose to Use a Different Python Interpreter section from this article.
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 on Windows and macOS comes bundled with its own Python interpreter for the latest supported Python version. FME Form (formerly FME Desktop) on Linux uses the system Python interpreter (eg. Ubuntu’s 20.04’s 3.8 interpreter).
Why Choose to Use a Different Python Interpreter
On Windows, it is possible to use a different interpreter than the one that comes shipped with FME as long as it is a version that is supported in the FME version used. For example, FME 2024.x for Windows supports Python 3.8-3.12.
There are various reasons you might choose a different Python interpreter.
- 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 than which FME installs, you will need to install that version separately and direct FME to use it. For example, FME 2024.x on Windows comes bundled with a Python 3.12 interpreter. Integrating FME with 3rd-party Python modules that only work under Python 3.6 would require the installation and use of a 3.6 interpreter.
Different Python versions will be supported depending on the FME version. Check to see which version is supported by going to the version-specific page for Python Compatibility documentation or by opening a workspace in Workbench and checking the Python Compatibility parameter (Navigator pane > Workspace Parameters > Scripting > Python Compatibility).
Using ArcGIS's Interpreter
When creating a Python script for use with both FME and ArcGIS arcpy, you should point FME to use the Python Interpreter installed by ArcGIS, to ensure both applications work.
If you wish to use the interpreter installed by ArcGIS Desktop or ArcPro, check to see if FME and the ArcGIS version installed are compatible. If they are compatible, follow the instructions in this article and ensure the workspace’s Python Compatibility setting is set to the appropriate ArcGIS option.
Installing Python for Use with FME
If you are installing python for use with FME Flow you should choose the "Install for all users" option in the Python installer, otherwise 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.
Setting a Custom Python Interpreter for FME Form
FME Form on Windows
To choose a different Python interpreter for FME requires you to select that interpreter's DLL file.
In FME Form, select Tools > FME Options from the menu bar.
In the FME Options dialog, select the tab for “Translation", and navigate to the Preferred Python Interpreter setting under the Python Interpreter section. Click on the drop-down and select “Use Custom Interpreter…”.
Enter the location of the Python DLL you wish to use. If you are having trouble with determining the location of the python*.dll, please see the section titled Where to Find the Python DLL below.
You can also set PYTHONHOME using the Python Home field. It may be necessary to set this for users with multiple Python installations, so the interpreter knows to use which set of standard libraries should be used. More information on the PYTHONHOME environment variable can be found here.
NOTE: This option controls FME as a whole, and not just the current workspace. Therefore, all FME workspaces that have a Python Compatibility value that is compatible with the specified interpreter will use this alternative version of Python, until you revert this option.
Setting a Custom Python Interpreter for FME Flow
FME Flow on Windows
To change the Python interpreter on FME Flow on Windows, please see the FME Flow Administrator's Guide on how to configure the python interpreter.
FME Flow on Linux (2018.1)
Note: As of FME 2019, you cannot change interpreters for FME Flow on Linux.
To change Python interpreter for Linux, open a terminal window and run the following commands:
<FMEServerDir>Server/fme/fme APPLY_SETTINGS SYSTEM "Python/Use Custom Python <32|64>" true <FMEServerDir>Server/fme/fme APPLY_SETTINGS SYSTEM "Python/Python Interpreter <32|64>" /<path>/libpython2.7.so <FMEServerDir>Server/fme/fme APPLY_SETTINGS SYSTEM "Python/Custom Python Home <32|64>" /<path_to_python_home>
For <32|64>, specify 32 for 32-bit FME Server and 64 for 64-bit FME Flow.
<path_to_python_home> is the installation location of Python.
FME Server on Linux (2018.0 and older)
To change Python interpreter, open a terminal window 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
Where to Find the Python DLL
The name of the DLL will always be "python<majorVersion><minorVersion>.dll" (eg. python39.dll or python27.dll). The location of the Python DLL depends on how you installed Python and the version of Python installed.
Python 3.x
As it is possible to customize the installation location in Python 3.x, the path to the DLL varies. The default install location is:
C:\Users\<user>\AppData\Local\Programs\Python\Python<majorVersion><minorVersion>
where <user> is the user account name and <majorVersion> and <minorVersion> refers to the major and minor version of the Python installed.
If the DLL is not located in the above path, you can run the following script in the Python console. As the python3x.dll along with python.exe are located in the root Python installation folder. The DLL should be located in the returned path.
import sys,os exePath = sys.executable print(os.path.split(exePath)[0])
Python 2.7
Note: Python 2.7 has been deprecated for FME 2022 and newer. For more information, please see this article on Python 2.7 deprecation.
Windows bit architecture |
Python Installation Type |
Installed Python |
Path to DLL |
32-bit |
For all user |
32-bit Python 2.7 | C:\Windows\System32 |
64-bit |
For all users |
32-bit Python 2.7 |
C:\Windows\SysWOW64 |
64-bit |
For all users |
64-bit Python 2.7 |
C:\Windows\System32 |
32-bit & 64-bit |
Just for me |
32-bit & 64-bit Python 2.7 |
C:\Python27 |
Potential Issues 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 Flow will not be able to use this Python interpreter unless you were logged in as the user who is running the FME Server Service.
Comments
0 comments
Please sign in to leave a comment.