Question

Fatal Python error: Py_Initialize: unable to load the file system codec


Hello,

I try to create a Python Caller transformer. I set my Python interpreter in Tools>FME Options but when I try to run the transformer, I have the following error message :

The workspace expects Python version 3.7, but the user-specified Python library `C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python36.dll' is version 3.6 with PYTHONHOME `C:\\Program Files\\ArcGIS\\Pro\\bin\\Python'

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 0x0000283c (most recent call first):

 

Any idea ?


6 replies

Userlevel 3
Badge +17

Hi @romainttqib

If you wish to use ArcGIS Pro's interpreter, please set the workspace's Python Compatibility parameter in the Navigator pane to Esri ArcGIS Python 3.6. Depending on the FME version used, the exact wording of the parameter choice may be different.

Please clear the options set in Tools > FME Options > Preferred Python Interpreter. It is not necessary to set the Preferred Python Interpreter setting in order to use Esri's Python interpreters in recent versions of FME.

Userlevel 4

Also, for ArcGIS Pro make sure to use the 64-bit edition of FME.

Hi @romainttqib

If you wish to use ArcGIS Pro's interpreter, please set the workspace's Python Compatibility parameter in the Navigator pane to Esri ArcGIS Python 3.6. Depending on the FME version used, the exact wording of the parameter choice may be different.

Please clear the options set in Tools > FME Options > Preferred Python Interpreter. It is not necessary to set the Preferred Python Interpreter setting in order to use Esri's Python interpreters in recent versions of FME.

Thank you !

Badge

I had this problem as well. Because of the incompatibility of the FME version I am using (2020.0.2) with the ArcGIS Pro Version (2.6.3), the Python Compatibility to ESRI ArcGIs Pro Python 3.6 did not work for me and I had to use a different solution.

 

For me the solution was like this:

  1. In the workspace Parameters - Scripting set the Python Compatibility to Python 3.6+
  2. In Workbench - FME Options - Translation Settings set Python Interpreter to "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python36.dll"
  3. In Workbench - FME Options - Translation Settings set Python Home to "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3"
  4. Check the System Environment variables and ensure there are no PATH or PYTHONPATH variables pointing to a different or older version python
  5. Add a PYTHONPATH environment variable like this "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3;C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\Lib;C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\Lib\\site-packages"

You will need to sign out and in of your machine for the Environment Variables to take effect.

 

Userlevel 3
Badge +17

I had this problem as well. Because of the incompatibility of the FME version I am using (2020.0.2) with the ArcGIS Pro Version (2.6.3), the Python Compatibility to ESRI ArcGIs Pro Python 3.6 did not work for me and I had to use a different solution.

 

For me the solution was like this:

  1. In the workspace Parameters - Scripting set the Python Compatibility to Python 3.6+
  2. In Workbench - FME Options - Translation Settings set Python Interpreter to "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python36.dll"
  3. In Workbench - FME Options - Translation Settings set Python Home to "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3"
  4. Check the System Environment variables and ensure there are no PATH or PYTHONPATH variables pointing to a different or older version python
  5. Add a PYTHONPATH environment variable like this "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3;C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\Lib;C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\Lib\\site-packages"

You will need to sign out and in of your machine for the Environment Variables to take effect.

 

Hi @braggken​ 

Thank you for sharing your findings! That's strange the Python Compatibility parameter did not work.

A colleague tested ArcGIS Pro 2.6.3 with the latest FME 2020.2 release and could not reproduce the error you are seeing.

What version of FME are you using? Pro 2.6.x should be compatible with FME 2020.1.2 and newer.

Badge

Hi @braggken​ 

Thank you for sharing your findings! That's strange the Python Compatibility parameter did not work.

A colleague tested ArcGIS Pro 2.6.3 with the latest FME 2020.2 release and could not reproduce the error you are seeing.

What version of FME are you using? Pro 2.6.x should be compatible with FME 2020.1.2 and newer.

Hi @debbiatsafe​ 

Yes I think you're right the incompatibility of the FME version (2020.0.2) with the ArcGIS Pro Version (2.6.3) must be the reason I had to go these lengths. I'll edit my earlier post.

Reply