Question

Running python caller to use 3.6 with ArcMap and ArcPro installed on same environment.

  • 5 October 2021
  • 3 replies
  • 28 views

Badge +9

Hi I have seen a number of questions relating to this flowline of using ArcPro python with FME but I cant find a solution for my set up.

 

I have ArcMap 10.8 and ArcPro 2.6 installed in same environment

 

I am using FME 2021 64 Bit. I currently have a lot of workspaces set up to use acrpy for fme feature processing through the python caller. This whole flowline is working for fme and arcmap using 2.7 python.

 

I want to replicate my workspaces to run the same processes using ArcPro with python 3.6 . When I run my workspaces that include python callers I get the following error message immediately on startup

 

2021-10-05 00:39:12| 0.0| 0.0|INFORM|Using Python interpreter from `C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python36.dll' with PYTHONHOME `C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3'

2021-10-05 00:39:12| 0.0| 0.0|INFORM|Python version 3.6 loaded successfully

Failed to import the site module

Error processing line 1 of C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site-packages\\bind_cpu.pth:

Traceback (most recent call last):

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 168, in addpackage

exec(line)

File "<string>", line 1, in <module>

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site-packages\\despatch\\__init__.py", line 7, in <module>

from .despatch import set_optimal, set_cpu_type # noqa

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site-packages\\despatch\\despatch.py", line 6, in <module>

from x86cpu import info

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site-packages\\x86cpu\\__init__.py", line 6, in <module>

from ._version import get_versions

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site-packages\\x86cpu\\_version.py", line 7, in <module>

import json

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\json\\__init__.py", line 106, in <module>

from .decoder import JSONDecoder, JSONDecodeError

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\json\\decoder.py", line 3, in <module>

import re

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\re.py", line 122, in <module>

import enum

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\enum.py", line 2, in <module>

from types import MappingProxyType, DynamicClassAttribute

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\types.py", line 171, in <module>

import functools as _functools

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\functools.py", line 21, in <module>

from collections import namedtuple

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\collections\\__init__.py", line 32, in <module>

from reprlib import recursive_repr as _recursive_repr

File "C:\\Program Files (x86)\\Python27\\ArcGIS10.8\\Lib\\site-packages\\reprlib\\__init__.py", line 7, in <module>

raise ImportError('This package should not be accessible on Python 3. '

ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 550, in <module>

main()

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 532, in main

known_paths = addsitepackages(known_paths)

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 320, in addsitepackages

addsitedir(sitedir, known_paths)

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 207, in addsitedir

addpackage(sitedir, name, known_paths)

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\site.py", line 178, in addpackage

import traceback

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\traceback.py", line 3, in <module>

import collections

File "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\collections\\__init__.py", line 32, in <module>

from reprlib import recursive_repr as _recursive_repr

File "C:\\Program Files (x86)\\Python27\\ArcGIS10.8\\Lib\\site-packages\\reprlib\\__init__.py", line 7, in <module>

raise ImportError('This package should not be accessible on Python 3. '

ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

 

 

I assume this is the culprit

 

File "C:\\Program Files (x86)\\Python27\\ArcGIS10.8\\Lib\\site-packages\\reprlib\\__init__.py", line 7, in <module>

 

How do I resolve this?

 

I have set the python interpreter and compatibility and PYTHONPATH but still have the same error

 

PYTHON 

I have also set the arc compatibility as Pro

 

Do I need to change something in Python path environment variable?

 

I still want to be able to use FME, arcmap and 2.7 python in the same environment for the forseeable I just want to be able to switch between the python interpreters in FME for when I want to process using FME/Arcpro and python 3.6

 

I thought it would be easier than its turning out to be!

 

Thanks in advance

 

Ciara

 

 


3 replies

Userlevel 3
Badge +17

Hi @ciarab​ 

The most likely cause of the error is the presence of a Python 2.7 directory (eg. C:\\Program Files (x86)\\Python27\\ArcGIS10.8\\Lib\\site-packages) in PATH or PYTHONPATH. Try checking for any Python 2.7-specific paths in PATH and/or PYTHONPATH and removing them.

Note that you do not need to set a custom Python interpreter in order to use ArcGIS's Python. Setting the workspace's Python Compatibility should be sufficient.

Badge +9

@debbiatsafe​ thank you for that, I was hoping it would be as easy as setting the python compatibility.

 

Do you know if  C:\\Program Files (x86)\\Python27\\ArcGIS10.8\\Lib\\site-packages is removed from the python path will that have any impact then on running the workspaces I have configured to run with ArcMap 10.8 and FME 2019.1 with python 2.7

 

I am attempting to migrate a rather large (MASSIVE) flowline to ArcPro its going to take a number of months to complete. Goal then is to have FME integrated with Pro and 3.6 but I am a good way away from that.

 

In the meantime I still want to be capable of running this workflow in ArcMap python 2.7 and FME integrated. So I dont want to break that working process if at all possible . I am working in development environment so at least thats something 😂

Userlevel 3
Badge +17

Hi @ciarab​ 

You're very welcome.

I don't believe removing  C:\Program Files (x86)\Python27\ArcGIS10.8\Lib\site-packages from the Python path environment variable will make a difference in FME. 

If the Python Compatibility parameter is set to Esri ArcGIS Python 2.7, then this directory is included as a directory to search. You can verify this by printing the search paths:

import sys
print(sys.path)

You should see the same site-package path in the list that is printed.

Reply