cassandra_snapshotter icon indicating copy to clipboard operation
cassandra_snapshotter copied to clipboard

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

Open AmitTeli opened this issue 6 years ago • 8 comments

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

AmitTeli avatar May 11 '18 06:05 AmitTeli

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

artursmolarek avatar May 14 '18 11:05 artursmolarek

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)):
                        ^

AmitTeli avatar May 15 '18 04:05 AmitTeli

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

tbarbugli avatar May 15 '18 08:05 tbarbugli

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!

AmitTeli avatar May 15 '18 11:05 AmitTeli

glad to hear that!

tbarbugli avatar May 15 '18 12:05 tbarbugli

@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?

ndamclean avatar Jun 18 '18 23:06 ndamclean

artursmolarek's answer also fixed the issue on my macos

SquirrelAssassin avatar Jun 21 '18 22:06 SquirrelAssassin

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

AWSGitHubConnector avatar Feb 06 '24 10:02 AWSGitHubConnector