I have an issue with some Python code in Form 2024.1.
I have to make a connection to a PostgreSQL database using psycogp2. When I run the PythonCaller in my workspace then it fails with an error message that psycogp2 is missing (Python Exception <ModuleNotFoundError>: No module named 'psycopg2')
I tried to single out the problem in a minimal workspace (attached), but here it works without a problem. Hence, I am wondering how and what is causing the issue. The actual workspace is rather big and I will share a screenshot of the essential part that is failing.
The AttributeManager10 receives a single feature from the summary port of a FeatureWriter and in AttributeManager10 all other exposed attributes are deleted, except the site_id (integer) is kept. Unexposed attributes are there only two:
- fme_geometry -> fme_undefined
- fme_type -> fme_no_geom

Running to the Attributemanager10 works fine. The next partial run of PythonCaller_4 fails with:
2025-04-30 13:46:19| 3.6| 3.4|ERROR |Message Type: fme::internal::_v0::py::Exception
2025-04-30 13:46:19| 3.6| 0.0|ERROR |Python Exception <ModuleNotFoundError>: No module named 'psycopg2'
2025-04-30 13:46:19| 3.6| 0.0|ERROR |Error encountered while calling method `input'
2025-04-30 13:46:19| 3.6| 0.0|FATAL |PythonCaller_4 (PythonFactory): PythonFactory failed to process feature
Don’t get me wrong, we are talking about the same FME Form, where the PythonCaller works in one workspace with and integer as input and where it does not in the other workspace, claiming a Python module it can find earlier is not to be found 5 seconds later.