Skip to main content

I'm running a custom python interpreter (3.7 64 bit) as I cannot install the modules in the FME desktop python 3.7 environment.    I have been running the custom python without issue for other modules I installed:

The user-specified Python interpreter `C:\Users\aallan.BUROHAPPOLD\AppData\Local\Programs\Python\Python37x64\python37.dll' is version 3.7 with PYTHONHOME `C:\Users\aallan.BUROHAPPOLD\AppData\Local\Programs\Python\Python37x64'

Python version 3.7 loaded successfully

And I managed to install osmnx and networkx in the custom environment.

I have even been using osmnx and networkx successfully outside of FME using the IDLE IDE without problem, creating outputs etc. (nice ones). 

 

But back in FME, I try to import these modules I get this error:

Error  Âline 50] uWinError 126] The specified module could not be found

Line 50: import osmnx as ox
Line 51: import networkx as nx

So it gets tripped up on osmnx. I wonder whether it's lying when it said it successfully loaded my custom python environment....

No It reports that:

print(os.environÂ'PYTHONPATH'].split(os.pathsep))

a'C:\\Users\\aallan.BUROHAPPOLD\\AppData\\Local\\Programs\\Python\\Python37x64']

So does anyone know what the problem could be and how to solve it?

I'd rather not do a messy workaround and run python scripts using Popen/or os.system(cmd).

 

My guess is that FME is still using some python resources outside of my custom environment but can't show it.  Or OSMnx has some dependencies that are not compatible with FME Desktop PythonCaller...

I had previous seen some urllib3 import errors indicating incompatibility, so I upgraded requests and urllib3 and now have that somewhat smaller and less useful error: ÂWinError 126] The specified module could not be found.

Any ideas? 

 

WinError 126 can occur when is unable to find/load a dependency for one or more .dll's required for the osmnx module.

As a simple test, can you try finding any differences the paths output from the PATH environment variable between the IDLE environment and FME?

Alternatively, you can also try the suggestion here and use the sysinternals utility Process Monitor to find which dll is missing.


Try this:

  1. Add this to your startup script in your workspace:
import sys
sys.path.append('C:\\Users\\aallan.BUROHAPPOLD\\AppData\\Local\\Programs\\Python\\Python37x64')
  1. Check if your error is related to this StackOverflow Article.

WinError 126 can occur when is unable to find/load a dependency for one or more .dll's required for the osmnx module.

As a simple test, can you try finding any differences the paths output from the PATH environment variable between the IDLE environment and FME?

Alternatively, you can also try the suggestion here and use the sysinternals utility Process Monitor to find which dll is missing.

Thanks, I did find a few different paths between FME and IDLE. I added the IDLE ones into FME but it didn't solve it. Looking at the sysinternals- I couldn't initially figure out how get the dlls but can see them now, but mostly pyd files. I've added some extra paths to the specific site-package directories but no joy.


Try this:

  1. Add this to your startup script in your workspace:
import sys
sys.path.append('C:\\Users\\aallan.BUROHAPPOLD\\AppData\\Local\\Programs\\Python\\Python37x64')
  1. Check if your error is related to this StackOverflow Article.

Thanks, I tried that but it didn't change anything. Tried adding in multiple paths including the site-packages in the startup python script and in the pythoncaller script but it didn't do it. 


Thanks, I did find a few different paths between FME and IDLE. I added the IDLE ones into FME but it didn't solve it. Looking at the sysinternals- I couldn't initially figure out how get the dlls but can see them now, but mostly pyd files. I've added some extra paths to the specific site-package directories but no joy.

I tried using osmnx with a 3.7 Miniconda custom interpreter (because plain Python had a lot of issues installing osmnx) in FME.

I was not able to reproduce the exact error you were seeing but I did run into the error below when importing osmnx in the PythonCaller:

Could not find lib geos_c.dll or load any of its variants

To resolve this error, I had to add the path containing the .dll (C:\\Users\\<username>\\Miniconda3\\Library\\bin in my case) to the PATH environment variable and then restart Workbench. Based on my tests, simply appending this path within the PythonCaller did not work.

I'm not sure which .dll is not being loaded for you so my steps above may apply to your case. However, it may be worth a try to add bin directories from your custom Python environment to the PATH environment variable.


Reply