The path to the dll isn't necessarily what will determine which Python interpreter is actually used. Have you tried setting the PYTHONHOME environment variable? In more recent versions of FME 2018.1 you can set PYTHONHOME in the FME options, in earlier versions you'll have to define it as a system environment variable (and possibly restart your PC for it to take effect).
The path to the dll isn't necessarily what will determine which Python interpreter is actually used. Have you tried setting the PYTHONHOME environment variable? In more recent versions of FME 2018.1 you can set PYTHONHOME in the FME options, in earlier versions you'll have to define it as a system environment variable (and possibly restart your PC for it to take effect).
The PYTHONHOME is available in the FME translation option. I tried setting this to the directory that contains python.exe in my specific Anaconda environment ( C:\\(...)\\anaconda2\\envs\\gdal ). However, this didn't work, not even after restarting. It still appears FME is using its built-in Python with basic packages.
I was able to use FME with Anaconda as the Python interpreter using the following setup:
- FME 2018.1, 64-bit version
- Anaconda 4.5.11 with Python 3.6, 64-bit version
In FME Options:
In the workspace scripting parameters:
I think the most important aspect is to match up the "bitness" of FME and Anaconda, you cannot use FME 32-bit and Anaconda 64-bit, for example.
I was able to use FME with Anaconda as the Python interpreter using the following setup:
- FME 2018.1, 64-bit version
- Anaconda 4.5.11 with Python 3.6, 64-bit version
In FME Options:
In the workspace scripting parameters:
I think the most important aspect is to match up the "bitness" of FME and Anaconda, you cannot use FME 32-bit and Anaconda 64-bit, for example.
Thank you for your help and the screenshots. Running Anaconda2 seems to work well (FME,INFORM|Python version 2.7 loaded successfully). However for some reason I'm still unable to import custom packages (gdal,geopandas,rasterstats) from the FME pythoncaller, resulting in the following error:
ERROR |Python Exception : DLL load failed:
But importing the packages in the same anaconda environment using the anaconda prompt is succesfull
(gdal) C:\\>python Python 2.7.15 |Anaconda, Inc.| (default, Nov 13 2018, 17:33:26) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
>>> import geopandas
>>> import rasterstats
>>>
Do you have any idea what might cause this error?
Thank you for your help and the screenshots. Running Anaconda2 seems to work well (FME,INFORM|Python version 2.7 loaded successfully). However for some reason I'm still unable to import custom packages (gdal,geopandas,rasterstats) from the FME pythoncaller, resulting in the following error:
ERROR |Python Exception : DLL load failed:
But importing the packages in the same anaconda environment using the anaconda prompt is succesfull
(gdal) C:\>python Python 2.7.15 |Anaconda, Inc.| (default, Nov 13 2018, 17:33:26) hMSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
>>> import geopandas
>>> import rasterstats
>>>
Do you have any idea what might cause this error?
You can use a little known trick to invoke the Python prompt using FME, that way you have an interative session where you can inspect PYTHONPATH, versions, etc.
From the command line, go to the directory where FME is installed and type
fme.exe python
Hopefully that should help you locate the issue.
You can use a little known trick to invoke the Python prompt using FME, that way you have an interative session where you can inspect PYTHONPATH, versions, etc.
From the command line, go to the directory where FME is installed and type
fme.exe python
Hopefully that should help you locate the issue.
Yes with your help I found the issue!
For some reason FME Custom Python interpreter only referred to my base Anaconda environment, even with PYTHONPATH and dll in a different environment. Still no idea why.. But worked around by installing necessary packages in my base environment. Not perfect, but it does the job.
Thanks a lot!
Yes with your help I found the issue!
For some reason FME Custom Python interpreter only referred to my base Anaconda environment, even with PYTHONPATH and dll in a different environment. Still no idea why.. But worked around by installing necessary packages in my base environment. Not perfect, but it does the job.
Thanks a lot!
Excellent!
I had a similar issue configuring Anaconda with FME, this post helped but missed some details on compatibility. Hopefully this saves someone some time in the future
-The version of FME/Anaconda/Python must all be compatible. I have FME 2018.1 and require features implemented in non 2.7 python, while the current version of Anaconda is python 3.7 (No 2018 fme support). So I had to find an old version of Anaconda that supports a version 3 of python supported by FME. Anaconda3-4.2.0-Windows-x86_64 fills this need with python 3.5. Alternatively updating FME to 2019 would also solve this problem.
-Specify the paths per @david_r post
-If there is a compatibility of python issues FME will revert to it's default installation, ignoring the Anaconda install
-I also don't have local admin but the non-admin local install of Anaconda seems to work just fine (AppData\\Local\\Continuum\\
This thread is now 4 years old but there isn't a newer one (that I've found so far) the properly addresses the issue. Would someone who knows please update this thread to cover FME v2022? (and/or verify that the info in this thread still applies)
This thread is now 4 years old but there isn't a newer one (that I've found so far) the properly addresses the issue. Would someone who knows please update this thread to cover FME v2022? (and/or verify that the info in this thread still applies)
I had to update Anaconda for 2022 Fme and the process is the same as this thread. You get a version of anaconda that is compatible with 2022 fme python (python 3.6 - 3.9). Install it then set the python interpreter in (fme options- translation) to the location of the anaconda install and the python dll associated with the install (as in the screenshot above).
I am using FME 2023, have the same problem. However, is not clear, how to use a specific environment of Anacoda, not the base(root) one. As I understand @david_r uses the root in order to install packages pip install
I am using FME 2023, have the same problem. However, is not clear, how to use a specific environment of Anacoda, not the base(root) one. As I understand @david_r uses the root in order to install packages pip install
Indeed, but not always... It'd be too simple ;-)
If you really, really need all of Anaconda then it's possible (but sometimes fiddly) to point FME to your Anaconda folders. But if you only rely on a few modules present in Anaconda, it's probably easier to simply install those into FME, either in the user folder or the FME home folder.