Hey, I’ve been trying to get FME (Feature Manipulation Engine) by Safe Software to use Python libraries from QGIS (like qgis.core) so I can mix their cool features in my temp.fmw workspace. The idea is to use QGIS’s Python (version 3.9) inside FME by setting it up with PowerShell commands. But it’s not working, and here’s why, explained like I’m talking to a 5-year-old and then a bit more grown-up:
The Toy Box Story (Simple Version)
Imagine Python is a kid who needs toy helpers to do jobs—like QGIS toys (for maps) and FME toys (for data tricks). These toys are called DLLs (little helper files). I want Python to borrow toys from both QGIS’s toy box and FME’s toy box at the same time.
Step 1: I told Python, “Look in QGIS’s box (C:\Program Files\QGIS 3.32.0\apps\Python39) and FME’s box (C:\Program Files\FME\python)!” That’s like setting PYTHONHOME and PYTHONPATH.
Step 2: Python found some QGIS toys (like qgis.core), but then it yelled, “Where’s my Qt5Core.dll toy? I can’t play!” It’s like a toy broke because its little helper was missing.
Step 3: I said, “Check FME’s box too for fmesite!” It found fmesite, but then it cried again, “I need fmeobjects.dll and it’s not working!”
Why It’s Broken: Every time Python grabs a toy, it needs more little helper toys (DLLs) to make it work. I keep telling it where to look (using PATH), but it’s like the toy boxes are locked, and Python doesn’t have the key unless QGIS or FME opens them first. We’re mixing two picky toy bosses who don’t share well outside their own games.
The Techy Version (Why DLLs Are the Problem)
Here’s what’s really happening:
QGIS Python Setup: I’m using QGIS’s Python 3.9 (C:\Program Files\QGIS 3.32.0\apps\Python39) because my FME workspace (temp.fmw) needs QGIS libraries like qgis.core for map stuff. I set:
PYTHONHOME = "C:\Program Files\QGIS 3.32.0\apps\Python39"
PYTHONPATH to include QGIS’s libs (C:\Program Files\QGIS 3.32.0\apps\qgis\python) and FME’s (C:\Program Files\FME\python).
FME Needs: The workspace also uses FME’s Python stuff (like fmesite and fmeobjects), which live in C:\Program Files\FME\python.
The DLL Mess:
FME’s Side:
fmesite imports fmeobjects, a Python file (.pyd) that needs fmeobjects.dll from C:\Program Files\FME\bin.
I added C:\Program Files\FME\bin to PATH, but it still fails with ImportError: DLL load failed. Something else (another DLL, like a Microsoft runtime) might be missing, or QGIS’s Python doesn’t like FME’s 64-bit toys.
QGIS’s Side:
qgis.core works at first, but it needs PyQt5.QtCore (for GUI/map stuff), which needs Qt5Core.dll.
Then qgis._core (a deeper QGIS part) needs qgis_core.dll.
I added C:\Program Files\QGIS 3.32.0\bin and \apps\Qt5\bin to PATH, where these DLLs should be, but Python still can’t find them. Errors keep saying DLL load failed.
Why It Fails:
QGIS and FME set up their own “toy boxes” (environments) when you run them normally (like through qgis.bat or FME Workbench). They tweak PATH, PYTHONPATH, and other secret stuff so their DLLs load perfectly.
In PowerShell, I’m building a Frankenstein environment, mixing QGIS’s Python with FME’s libs. But without QGIS’s full setup (like its startup script), the DLLs don’t load—Python can’t find Qt5Core.dll, qgis_core.dll, or fmeobjects.dll properly, even with PATH set.
Questions for You:
Where are Qt5Core.dll, qgis_core.dll, and fmeobjects.dll really hiding on my system? Are they in bin or somewhere else?
How do I run QGIS’s Python in PowerShell with all its DLLs working, then add FME’s stuff?
Is there a better way to mix QGIS and FME toys without this DLL chaos?