I have a need to access some advanced graph algorithms in the RAPIDS (rapids.ai) package from a PythonCaller, which is normally installed as a Conda environment. I have found a few references on selecting the Conda-environment-specific Python interpreter, but unfortunately, they all assume we are running under Windows. We are running Ubuntu Linux, and the Linux installation of FME Form (as well as the macOS installation) doesn’t support custom interpreters.
Any ideas on how I can get around this? I’ve previously managed to install pip packages into the standard FME interpreter environment with no issues, but it’s very difficult to successfully install RAPIDS using pip due to its many binary dependencies.
Best answer by emma.at.safe
Hey @User17042260974539197207
There are a couple of ways to work around this:
Using PythonCaller you can use the built-in Python subprocess module to make command line calls. This would allow you to activate a Conda environment and run an external Python script from the PythonCaller transformer. However, you may need to serialize the FME Feature data to pass it out of the PythonCaller.
SystemCaller also works to spawn the process to call the command line.
Alternatively to serializing data manually through Python, you can check out this articlewhich explains how to write data with the FeatureWriter, execute a command on the data, then read the data with the FeatureReader to get the features back into the translation.
Hope this helps!
Emma
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
Using PythonCaller you can use the built-in Python subprocess module to make command line calls. This would allow you to activate a Conda environment and run an external Python script from the PythonCaller transformer. However, you may need to serialize the FME Feature data to pass it out of the PythonCaller.
SystemCaller also works to spawn the process to call the command line.
Alternatively to serializing data manually through Python, you can check out this articlewhich explains how to write data with the FeatureWriter, execute a command on the data, then read the data with the FeatureReader to get the features back into the translation.
Thanks, Emma! That makes sense as an option. But I’ve found a way to install the needed libraries using pip instead. When I first tried it, the pip installation failed. But I managed to get it working so I could use the standard procedure for adding Python packages to the FME Python runtime environment.