tbarbugli / cassandra_snapshotter

A tool to backup cassandra nodes using snapshots and incremental backups on S3
Other
222 stars 122 forks source link

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

Open AmitTeli opened 6 years ago

AmitTeli commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

AmitTeli commented 6 years ago

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 commented 6 years ago

glad to hear that!

ndamclean commented 6 years ago

@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 commented 6 years ago

artursmolarek's answer also fixed the issue on my macos

AWSGitHubConnector commented 7 months ago

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