6

I am trying import fabric.api and having issues with the same. I installed fabric using pip and in interpreter it when I run import fabric it works fine. But when i do from fabric.api import * it spews out an error saying no module named api I am using python 2.7 , Not sure what am i missing here, can you please guide

Python 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information.

version Traceback (most recent call last): File "", line 1, in NameError: name 'version' is not defined import fabric import fabric.api Traceback (most recent call last): File "", line 1, in ImportError: No module named api from "fabric.api" import * File "", line 1 from "fabric.api" import * ^

12

Fabric has made some major API changes from v1 to v2; to see the changes, visit Upgrading from Fabric 1.x: API organization. In particular, fabric.api is removed and everything is imported directly from the top-level package. This means that your scripts won't work with the current Fabric==2.0.1 version; you have two possibilities: rewrite your code to be compliant with v2, or install the latest v1 version:

$ pip install "fabric<2"
0

fabric.api is part of version

1.14

you installed

2.4

please check versions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.