The issue with numpy is that FME comes bundled with an old version pre-installed in the FME home directory. When numpy is imported, this installation takes precedence before any other numpy versions that have been installed in the user profile, which more often than not will make the module import fail with a version requirement error.
You can try forcing an upgrade of the numpy version in the install directory of FME. However, you do this at your own risk and peril since I have no idea if this might break any other modules in the install directory that requires this particular version of numpy!
That said, it's worked without issues for my relatively few uses cases so far. So if you feel lucky, try:
<FME_HOME>\fme.exe python -m pip install numpy --target <FME_HOME>\python\python310 FME_PYTHON_VERSION 310
Substitute "310" and "python310" for whichever Python version you're targeting.
Aha it is very good to know the issue with numpy in FME. Thx David 🙂
Since using numpy==1.16.1 with FME Python was perilous, the fix for us was to run Python natively outside of FME to make the ETL work.
Still the other question does remain. Does anyone know if pip uninstall is possible in FME Python?
I tested and it does not appear to be possible to use pip's uninstall command with FME's Python interpreter. I am not certain if this is by design or not. If you're curious, I can reach out to our development team.
In general, it is not recommended to make changes to the FME install directory. This includes upgrading specific libraries used by FME as it may corrupt the installation since they have not been tested with FME and may produce unexpected behaviour.
Note that numpy for Python 3 was upgraded to 1.18.5 for in FME 2021 and 1.23.4 in FME 2022. If possible, it is recommended to upgrade FME.
If you're unable to upgrade, you can install the required version of numpy at a custom location (eg. C:\Users\<user>\Documents\FME\Plugins\Python) following the instructions here and try promoting the folder location of the newer numpy module in Python PATH. For example:
import sys
sys.path.insert(0,r"C:\Users\<user>\Documents\FME\Plugins\Python") # May need to change the directory to your user-specific location
import numpy
This should ensure FME's Python interpreter searches the newer directory where the newer numpy modules are located first. This should allow the newer version to be loaded instead of the shipped numpy module.
Thanks for the answer still debbiatsafe Good to know the options