Skip to main content

I try to use the version 6.1.0 of Pillow. Using Python 3.6.

The code runs fine locally but in FME it still loads version 5.2.0 of Pillow from which is in FME local folder.

I set the Python compatibility to 3.6 and pointed to the correct interpreter and Python home dir.

What should I do for FME to load the correct version?

There's not much detail to work with here, so it's going to be pure speculation. But my first hunch would be to print out the Python path inside the script and check that there are no references to Python 2.7, e.g.

import sys
for p in sys.path:
    print(p)

There's not much detail to work with here, so it's going to be pure speculation. But my first hunch would be to print out the Python path inside the script and check that there are no references to Python 2.7, e.g.

import sys
for p in sys.path:
    print(p)

Thanks for the reply! I already did this and it says the following:

3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) iMSC v.1915 64 bit (AMD64)]

Which if even more weird as I point in the Translation to the the python 3.6 exe with version 3.6.8 (running it with the -V switch from the command prompt).

0684Q00000ArMWIQA3.png

 

I am running FME Home Edition - 2019.0.1.0 build 19253 -win64. But same problem with FME at work (full license).

The code in the pythoncaller:

import fme

 

import fmeobjects

 

from PIL import Image

 

from PIL.ExifTags import TAGS

 

import sys

 

# Template Function interface:

 

# When using this function, make sure its name is set as the value of

 

# the 'Class or Function to Process Features' transformer parameter

 

def processFeature(feature):

 

    pass

 

# Template Class Interface:

 

# When using this class, make sure its name is set as the value of

 

# the 'Class or Function to Process Features' transformer parameter

 

class FeatureProcessor(object):

 

    def __init__(self):

 

        pass

 

    def input(self,feature):

 

        print(sys.version)

 

        print(Image.__version__)

 

        self.pyoutput(feature)

 

    def close(self):

 

        pass

Thanks for the reply! I already did this and it says the following:

3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]

Which if even more weird as I point in the Translation to the the python 3.6 exe with version 3.6.8 (running it with the -V switch from the command prompt).

 

I am running FME Home Edition - 2019.0.1.0 build 19253 -win64. But same problem with FME at work (full license).

The code in the pythoncaller:

import fme

 

import fmeobjects

 

from PIL import Image

 

from PIL.ExifTags import TAGS

 

import sys

 

# Template Function interface:

 

# When using this function, make sure its name is set as the value of

 

# the 'Class or Function to Process Features' transformer parameter

 

def processFeature(feature):

 

pass

 

# Template Class Interface:

 

# When using this class, make sure its name is set as the value of

 

# the 'Class or Function to Process Features' transformer parameter

 

class FeatureProcessor(object):

 

def __init__(self):

 

pass

 

def input(self,feature):

 

print(sys.version)

 

print(Image.__version__)

 

self.pyoutput(feature)

 

def close(self):

 

pass

You're printing the Python version, but you also need to print the Python search path (see my post above), so that you can see where your interpreter instance is looking for modules.


David, I added your code:

C:\\Program Files\\FME\\python

C:\\Program Files\\FME\\python\\python37

C:\\Program Files\\FME\\fmepython37\\python37.zip

C:\\Program Files\\FME\\fmepython37\\DLLs

C:\\Program Files\\FME\\fmepython37\\lib

C:\\Program Files\\FME

C:\\Program Files\\FME\\fmepython37\\

C:\\Program Files\\FME\\fmepython37\\lib\\site-packages

C:\\Program Files\\FME\\fmeobjects\\python37

C:\\Program Files\\FME\\plugins

C:\\Users\\tjans\\Documents\\FME\\Plugins\\Python

C:\\Users\\tjans\\Documents\\FME\\Plugins\\Python\\python37

And indeed, in these directories there is an older version of Pillow, but how do I make reference my correct Python version ?

Are the settings in FME not correct?

 


It seems you have two different versions of Pillow installed on the search path, and the old one appears first. Two different possibilities that can be tested:

1) Modify the Python path before importing Pillow, e.g.

import sys
sys.path.insert(0, r'C:\Users\tjans\Documents\FME\Plugins\Python')
from PIL import ...

2) Upgrade the PIL version inside FME and hope it doesn't break anything, e.g.

fme.exe python -m pip install pillow --upgrade

It seems you have two different versions of Pillow installed on the search path, and the old one appears first. Two different possibilities that can be tested:

1) Modify the Python path before importing Pillow, e.g.

import sys
sys.path.insert(0, r'C:\Users\tjans\Documents\FME\Plugins\Python')
from PIL import ...

2) Upgrade the PIL version inside FME and hope it doesn't break anything, e.g.

fme.exe python -m pip install pillow --upgrade

Hi David, no luck here. There must be something wrong with my installation. Even the numpy used is a previous version. Thanks for the help anyway!


Reply