trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
488 stars 90 forks source link

Doesn't work with Python 3.8 #112

Closed vincent-dm closed 4 years ago

vincent-dm commented 4 years ago

After Homebrew upgraded Python from 3.7 to 3.8, awsume stopped working:

/usr/local/bin/awsume:5: /usr/local/bin/awsumepy: bad interpreter: /usr/local/opt/python/bin/python3.7: no such file or directory

Presumably because the awsumepy script contains a hashbang #!/usr/local/opt/python/bin/python3.7, which effectively ties it to Python 3.7.

When I create a symlink to Python 3.8, it also fails:

Traceback (most recent call last):
  File "/usr/local/bin/awsumepy", line 5, in <module>
    from awsume.awsumepy.main import main
ModuleNotFoundError: No module named 'awsume'

Presumably, awsume is not compatible with Python 3.8. Ideally it can be made compatible, so it can rely on a less specific version (e.g. #!/usr/bin/env python3).

mbarneyjr commented 4 years ago

The #! isn't awsume-specific. When installing python via brew, pip installing packages with console entry points will create a file that has a version-specific #! line. This seems like a homebrew issue, I don't know how much guidance I can provide with that.

FWIW, I strongly recommend installing python command-line tools with pipx, that would help prevent issues like this since each package is installed into a separate virtualenv

vincent-dm commented 4 years ago

Thank you for the explanation. And also for making the awesome awsume!

nmarchini commented 3 years ago

What was the fix for this in the end?

mbarneyjr commented 3 years ago

I'm not sure what exactly their solution was, but I do highly recommend the use of pipx for installing awsume. It should prevent these kinds of issues with brew since it installs everything into an isolated virtualenv (assuming you didn't try to pip install awsume globally)

ramonrovirosa commented 1 year ago

For me I had a similiar issue and a simple pipx uninstall awsume and then pipx install awsume fixed the issue.

I assume trying a pip uninstall awsume and pip install awsume might fix it.