Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue on ubuntu docker - ImportError: No module named 'fabric.api' #123

Open
AmitTeli opened this issue May 11, 2018 · 8 comments
Open

issue on ubuntu docker - ImportError: No module named 'fabric.api' #123

AmitTeli opened this issue May 11, 2018 · 8 comments

Comments

@AmitTeli
Copy link

This is my docker file.


FROM ubuntu:16.04

RUN apt-get update \
  && apt-get install -y python3-pip python3-dev \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3 python \
  && pip3 install --upgrade pip

RUN apt-get update
RUN apt-get -y install lzop
RUN apt-get -y install awscli
RUN pip install cassandra_snapshotter

When I run cassandra-snapshotter I get following error

root@1cdffbb6e473:/usr/work/cassandra# cassandra-snapshotter
Traceback (most recent call last):
  File "/usr/local/bin/cassandra-snapshotter", line 7, in <module>
    from cassandra_snapshotter.main import main
  File "/usr/local/lib/python3.5/dist-packages/cassandra_snapshotter/main.py", line 5, in <module>
    from fabric.api import env
ImportError: No module named 'fabric.api'

Appreciate the help!
Amit

@artursmolarek
Copy link

I noticed the same issue. In order to fix it, you have to downgrade fabric from 2.0.0 to 1.13.1:

pip install fabric==1.13.1

@AmitTeli
Copy link
Author

AmitTeli commented May 15, 2018

Thank you for the reply.
However with this downgraded fabric, now I am getting following

Traceback (most recent call last):
  File "/usr/local/bin/cassandra-snapshotter", line 7, in <module>
    from cassandra_snapshotter.main import main
  File "/usr/local/lib/python3.5/dist-packages/cassandra_snapshotter/main.py", line 5, in <module>
    from fabric.api import env
  File "/usr/local/lib/python3.5/dist-packages/fabric/api.py", line 10, in <module>
    from fabric.context_managers import (cd, hide, settings, show, path, prefix,
  File "/usr/local/lib/python3.5/dist-packages/fabric/context_managers.py", line 535
    def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
                        ^

@tbarbugli
Copy link
Owner

looks like a Python 3 support issue, I suggest going with py2.7

@AmitTeli
Copy link
Author

Thanks a ton to @tbarbugli and @artursmolarek !
Python 2.7 and Fabric 1.13.1 works.
my final docker file

FROM python:2.7

RUN apt-get update
RUN apt-get -y install lzop
RUN apt-get -y install awscli
RUN pip install fabric==1.13.1
RUN pip install cassandra_snapshotter

CMD /bin/bash

works fine.
Thanks again!

@tbarbugli
Copy link
Owner

glad to hear that!

@ndamclean
Copy link

@tbarbugli It looks like you fixed this in 1.0.1 (thank you)

I was wondering when I might expect a release for this patch version to be pushed to PyPi?

@SquirrelAssassin
Copy link

artursmolarek's answer also fixed the issue on my macos

@AWSGitHubConnector
Copy link

python 2 is deprecated. Is their any way this can work on python 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants