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

Use boto3 instead of awscli python module to copy packages #387

Open
talebzeghmi opened this issue Nov 14, 2020 · 3 comments · May be fixed by #1778
Open

Use boto3 instead of awscli python module to copy packages #387

talebzeghmi opened this issue Nov 14, 2020 · 3 comments · May be fixed by #1778

Comments

@talebzeghmi
Copy link

awscli is superseded by awscliv2 which doesn't support a Python package.

Solution:

@savingoyal
Copy link
Collaborator

Thanks for the issue! Yes indeed, awscli happens to be an undeclared dependency (we should document it). We should look into what is the credible way forward for using awscliv2. s3op.py get wouldn't work because we have a bootstrapping problem - we need to download it from s3.

@talebzeghmi
Copy link
Author

True about the bootstrapping. I like the minimal dependencies. With boto3 I tested replacing https://github.com/Netflix/metaflow/blob/master/metaflow/environment.py#L90 with:

    def get_python_download_s3_file(self, file_url, local_path):
        return (
            "%s -c \"import boto3; " % self._python()
            + "exec('try:\\n from urlparse import urlparse\\nexcept:\\n from urllib.parse import urlparse');"
            + "parsed = urlparse('%s'); " % file_url
            + "boto3.client('s3').download_file(parsed.netloc, parsed.path.lstrip('/'), '%s')\"" % local_path
        )

@trhodeos
Copy link
Contributor

@savingoyal I've reopened a PR for this because we are seeing issues where if someone has both awscli v1 and v2 installed, the python dependencies are incompatible / break in weird ways. So instead of relying on this implicit dependency on awscli v1, we should just use boto3 to bootstrap.

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