I have install fabric using pip3 install fabric2,
I can import fabric without any issues however
from fabric.api import *
does not work, it just throws this error, I wonder if the names and the structure of the classes change?
File "main.py", line 1, in
from fabric.api import *
ImportError: No module named 'fabric.api'
I'm working on python3, and also realized that fabric1.x only supports python2.x
Hi @kaangoksal. Fabric v2 was just released, and the API is significantly different from v1. See: http://docs.fabfile.org/en/latest/upgrading.html
And http://docs.fabfile.org/en/v2/getting-started.html#a-note-about-imports
pip uninstall fabric
pip install fabric3
@pushplataranjan your tip helped me a lot, it works. Thank's
There is so much outdated documentation and examples out there. 😭
You should use: pipenv install fabric2
.
That's an unauthorized fork @pushplataranjan .
See this: http://www.fabfile.org/installing.html#fabric-and-fabric2-vs-fabric3
pip uninstall fabric
pip install fabric3
This actually worked for me!
pip3 unsinstall fabric
pip3 install fabric3
This worked for me. CentOS 8
some detail, for those who end up here:
fabric3 is a python-3-compatible fork of Fabric-1.x, and fabric3 is no longer maintained, for the past 3 years or so: https://github.com/mathiasertl/fabric/#deprecrecated
This may be totally fine for you, it's probably more important that you use a more recent "paramiko" library, which fabric uses for ssh connections. The "fabric" part is really just about organizing tasks and config, however works for you works.
It just so happens that I continue to maintain a Fabric-1.x fork (https://github.com/ploxiln/fab-classic) which includes the changes from fabric3. (To complicate things a bit, recent versions of fab-classic have a default dependency on my own fork of paramiko (https://github.com/ploxiln/paramiko-ng/). It's possible to switch that back to original paramiko with an environment variable - see the README - but for simple cases it is easier to pip uninstall paramiko fabric fabric3; pip install fab-classic
)
pip install fabric==1.14.0
pip install fabtools
this worked for me.
Most helpful comment
pip uninstall fabric
pip install fabric3