Question

how to pip uninstall Python packages on FME Desktop?

  • 16 January 2023
  • 4 replies
  • 32 views

The Python package <numpy> in FME is using version 1.15.1 and I want to switch to version 1.16.1. Already tried to force reinstall:

fme.exe python -m pip install --upgrade --force-reinstall numpy==1.16.1 --target C:\Users\301650\Documents\FME\Plugins\Python\python37

It does install numpy 1.16.1. However FME Desktop is still using numpy 1.15.1. Is it possible to uninstall Python package in fme.exe python?

 

It would be nice if command below does work, but currently it does not: 

fme.exe python -m pip uninstall numpy
 
--------------------------------------------------------------------------------------------------------------------
fme.exe python -m pip uninstall numpy
 
Python version 3.7 loaded successfully
 
Usage:
  C:\Program Files\FME\fmepython37\python.exe -m pip uninstall [options] <package> ...
  C:\Program Files\FME\fmepython37\python.exe -m pip uninstall [options] -r <requirements file> ...
 
no such option: --target
 
Error in running the Python command 'python %0'
Program Terminating
 
Translation FAILED.

Documentation can be added here: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Desktop/Workbench/Installing-Python-Packages.htm.

 


4 replies

Userlevel 4

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?

Userlevel 3
Badge +17

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

Reply