Skip to main content
Solved

Python, external package installation, problem

  • June 30, 2020
  • 7 replies
  • 166 views

Dear Community, 

 

I would like to integrate one external library called pyntcloud (https://github.com/daavoo/pyntcloud) within a workspace. I have made some testing within conda environment and everything worked perfectly. 

 

However, when I wanted to run it within a FME workspace there was a problem with a package. The following error occurs:

2020-06-30 15:43:16|   0.5|  0.0|INFORM|Using Python interpreter from `C:\Program Files\FME\fmepython37\python37.dll' with PYTHONHOME `C:\Program Files\FME\fmepython37'
2020-06-30 15:43:16|   0.5|  0.0|INFORM|Python version 3.7 loaded successfully
2020-06-30 15:43:16|   0.5|  0.0|INFORM|Adding folder `C:\Users\SAVe\AppData\Local\Temp\' to the python path
2020-06-30 15:43:16|   0.5|  0.0|INFORM|Emptying factory pipeline
2020-06-30 15:43:17|   1.3|  0.8|ERROR |Python Exception <OSError>: [WinError 126] The specified module could not be found
2020-06-30 15:43:17|   1.3|  0.0|ERROR |Error executing string `import<space>fme<lf>import<space>fmeobjects<lf><lf>import<space>pyntcloud<lf><lf>def<space>processFeature<openparen>feature<closeparen>:<lf><space><space><space><space>pass<lf><lf>'
2020-06-30 15:43:17|   1.3|  0.0|FATAL |Factory proxy not initialized
2020-06-30 15:43:17|   1.3|  0.0|FATAL |PythonCaller (PythonFactory): PythonFactory failed to process feature
2020-06-30 15:43:17|   1.3|  0.0|ERROR |A fatal error has occurred. Check the logfile above for details

Even tough I have seen how to perform the installation (https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Workbench/Workbench/Installing-Python-Packages.htm). I have tried also to change native interpreter to Python 3.6 (as in case of my conda testing but still FME enforces Python 3.7).

 

I thought that alternative solution could be to point out to conda interpreter0684Q00000ArCpcQAF.png but then this error occurs: 

2020-06-30 15:40:18|   0.5|  0.0|INFORM|The user-specified Python interpreter `C:\Users\SAVe\.conda\envs\YOLO\python36.dll' is version 3.6 with PYTHONHOME `C:\Users\SAVe\.conda\envs\YOLO'
2020-06-30 15:40:18|   0.5|  0.0|INFORM|Python version 3.6 loaded successfully
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00005e40 (most recent call first):
Error running translation.

 

Do you have any idea how to solve this?

Best answer by oloocki

Thanks Guys (@fhilding @david_r @jstanger) for those answers! I have found a solution!

 

However, I would like to give some hints by explaining my steps for solving the problem:

  1. Pyntcloud does not work with Python 3.7 properly and indeed scipy cause some problems. I have opened the ticket at the GitHub repo.
  2. ...but it does work with Python 3.6! Therefore, I have created a virtual environment within conda and set up it as Custom Interpreter (see @david_r link) . The environment triggered but the package not as somehow FME was still looking within main packages of conda, not within my virtual environment.
  3. So, I have figured out a different approach. I have downloaded standard Python 3.6 and used pip to install pyntcloud. Then pointed out to this Python in the FME configuration (here, double-check whether PYTHONHOME, PYTHONPATH and Path point out to the same Python directory in your Windows variables). Now... it is working!
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

Forum|alt.badge.img+1
  • 56 replies
  • June 30, 2020

I think the conda-approach could work, but then you might need to install all the modules that come with Python+FME, to not run into issues. I think that's why the encoding-import fails - but even installing it the "right" FME-way, I couldn't get it to load either - I'll try some more stuff!

EDIT:

 

When I run fme.exe python from cmd (to get the python interpreter that FME will use, good for debugging), and then write import pyntcloud, I get this error: 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\pyntcloud\__init__.py", line 1, in <module>
    from .core_class import PyntCloud
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\pyntcloud\core_class.py", line 6, in <module>
    from .structures.base import StructuresDict
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\pyntcloud\structures\__init__.py", line 4, in <module>
    from .convex_hull import ConvexHull
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\pyntcloud\structures\convex_hull.py", line 2, in <module>
    from scipy.spatial import ConvexHull as scipy_ConvexHull
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\scipy\__init__.py", line 104, in <module>
    from . import _distributor_init
  File "C:\Users\mywindowsaccount\Documents\FME\Plugins\Python\scipy\_distributor_init.py", line 61, in <module>
    WinDLL(os.path.abspath(filename))
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\__init__.py", line 364, in __init__
OSError: [WinError 126] The specified module could not be found

So, something in some underlying project hasn't gone well. scipy seems to be the issue, since it points to a path that absolutely doesn't exist. 

 


  • Author
  • 7 replies
  • July 2, 2020

@fhilding Thank you for your answer. I posted this issue at the GitHub repo of pyntcloud.


  • Author
  • 7 replies
  • July 2, 2020

@david_r I have seen your comment here. Would you mind to give some hints why conda environment is not cooperating? :)


david_r
Celebrity
  • 8392 replies
  • July 2, 2020

I haven't used conda much, and not with venvs, but have you already looked at this post?

https://knowledge.safe.com/questions/83789/configuring-anaconda-environment-in-fme.html


jstanger
Forum|alt.badge.img+1
  • 44 replies
  • July 10, 2020

While I haven't tested anything specifically with this package, from recent Python experiments in FME I did find that sometimes you get package conflicts. If pyntcloud depends on a library that FME already uses you might have a version conflict.

Try importing all the dependencies and print their module.__version__ then compare between your venv result and FME. If it is different you can play silly games with temporary changes to sys.path to get around it.


  • Author
  • 7 replies
  • Best Answer
  • July 14, 2020

Thanks Guys (@fhilding @david_r @jstanger) for those answers! I have found a solution!

 

However, I would like to give some hints by explaining my steps for solving the problem:

  1. Pyntcloud does not work with Python 3.7 properly and indeed scipy cause some problems. I have opened the ticket at the GitHub repo.
  2. ...but it does work with Python 3.6! Therefore, I have created a virtual environment within conda and set up it as Custom Interpreter (see @david_r link) . The environment triggered but the package not as somehow FME was still looking within main packages of conda, not within my virtual environment.
  3. So, I have figured out a different approach. I have downloaded standard Python 3.6 and used pip to install pyntcloud. Then pointed out to this Python in the FME configuration (here, double-check whether PYTHONHOME, PYTHONPATH and Path point out to the same Python directory in your Windows variables). Now... it is working!

Forum|alt.badge.img+1
  • 56 replies
  • July 15, 2020

Thanks Guys (@fhilding @david_r @jstanger) for those answers! I have found a solution!

 

However, I would like to give some hints by explaining my steps for solving the problem:

  1. Pyntcloud does not work with Python 3.7 properly and indeed scipy cause some problems. I have opened the ticket at the GitHub repo.
  2. ...but it does work with Python 3.6! Therefore, I have created a virtual environment within conda and set up it as Custom Interpreter (see @david_r link) . The environment triggered but the package not as somehow FME was still looking within main packages of conda, not within my virtual environment.
  3. So, I have figured out a different approach. I have downloaded standard Python 3.6 and used pip to install pyntcloud. Then pointed out to this Python in the FME configuration (here, double-check whether PYTHONHOME, PYTHONPATH and Path point out to the same Python directory in your Windows variables). Now... it is working!

Nice job with the fastidious debugging, @oloocki!