Search code examples
pythonpython-3.5importerrorfabric

Fabric on Python3 Errors out- ImportError: cannot import name 'isMappingType'


I got the following error when I was executing my project that calls fabfile.py. I use a simple subprocess.Popen() to call the fabric task. I am on Python 3.5.1.

File ".bootstrap/_pex/pex.py", line 367, in execute
  File ".bootstrap/_pex/pex.py", line 293, in _wrap_coverage
  File ".bootstrap/_pex/pex.py", line 325, in _wrap_profiling
  File ".bootstrap/_pex/pex.py", line 410, in _execute
  File ".bootstrap/_pex/pex.py", line 468, in execute_entry
  File ".bootstrap/_pex/pex.py", line 482, in execute_pkg_resources
  File ".bootstrap/pkg_resources/__init__.py", line 2297, in resolve
  File "/root/.pex/install/Fabric-1.8.3-py3-none-any.whl.ce45adfdb68b47d81b8a5f6b262ce685c93dfc0b/Fabric-1.8.3-py3-none-any.whl/fabric/main.py", line 12, in <module>
    from operator import isMappingType
ImportError: cannot import name 'isMappingType'

I've seen many people getting this error, and answers like fabric does not support Python3. But I think that's old news.

Right now, Fabric has Python3 compatibility (specifically, they now support 2.7 and 3,4+)

Can anyone tell me why is that I'm facing this error even now?


Solution

  • You are using old version of Fabric 1.8.3, Fabric (2+) has Python 3 compatibility (now support 2.7 and 3.4+) Therefore, kindly upgrade to the latest version of Fabric Module, considering the upgrade documentation http://docs.fabfile.org/en/latest/upgrading.html