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

Can't get past the alias/sourcing error. #238

Closed
matale opened this issue Oct 7, 2023 · 13 comments · Fixed by #260
Closed

Can't get past the alias/sourcing error. #238

matale opened this issue Oct 7, 2023 · 13 comments · Fixed by #260
Labels

Comments

@matale
Copy link

matale commented Oct 7, 2023

Have Python setup using asdf on an Intel Mac.

Did the awsume installation.

Running awsume command I get.

Warning: the awsume shell script is not being sourced, please use awsume-configure to install the alias
Awsume error: Profile default not found.
/Users/roman/.asdf/installs/python/3.12.0/bin/awsume: line 183: return: can only `return' from a function or sourced script

Running awsume-configure I get:

Traceback (most recent call last):
  File "/Users/roman/.asdf/installs/python/3.12.0/bin/awsume-configure", line 5, in <module>
    from awsume.configure.main import main
  File "/Users/roman/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/awsume/configure/__init__.py", line 1, in <module>
    from awsume.configure import alias
  File "/Users/roman/.asdf/installs/python/3.12.0/lib/python3.12/site-packages/awsume/configure/alias.py", line 2, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

I have also tried manually adding
alias awsume=". awsume" to my .zshrc file still get the first error.

@thisKeeWord
Copy link

Also encountering the issue

@fauzanelka
Copy link

alias awsume=". $(asdf which awsume)"

@mtskillman mtskillman added the bug label Nov 17, 2023
@sethwrowan
Copy link

I was also having this issue when I attempt to run awsume-configure after installing Awsume with Homebrew.

 ~ awsume-configure                                                                                                                                 1 ✘  14:17:57
Traceback (most recent call last):
  File "/opt/homebrew/bin/awsume-configure", line 5, in <module>
    from awsume.configure.main import main
  File "/opt/homebrew/Cellar/awsume/4.5.3_3/libexec/lib/python3.12/site-packages/awsume/configure/__init__.py", line 1, in <module>
    from awsume.configure import alias
  File "/opt/homebrew/Cellar/awsume/4.5.3_3/libexec/lib/python3.12/site-packages/awsume/configure/alias.py", line 2, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

It seems like the issue could be its dependence on Python 3.12, which no longer includes distutils in the standard library according to the Python 3.12 release notes.

I was able to get around this by dropping back to Python 3.11 as my default Python version, making sure the awsume module was installed with pip, and running the awsume-configure script directly instead of using the awsume-configure command.

I was then able to run awsume command with the alias in my .zshrc file

alias awsume=". awsume"

@mtskillman
Copy link
Collaborator

this will/was resolved by #239

we need to release new version of awsume soon to address this

@lhendrick-t10
Copy link
Collaborator

Released 4.5.4.rc0 for testing - will publish full version bump today

@lhendrick-t10
Copy link
Collaborator

Hey @matale - we have officially published 4.5.4 - can you confirm that this issue has been resolved?

@metametadata
Copy link

Reproducible in macOS Sonoma 14.4.1 for version 4.5.3:

~ ᐅ awsume-configure 
Traceback (most recent call last):
  File "/Users/yuri/.local/bin/awsume-configure", line 5, in <module>
    from awsume.configure.main import main
  File "/Users/yuri/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/__init__.py", line 1, in <module>
    from awsume.configure import alias
  File "/Users/yuri/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/alias.py", line 2, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'

we have officially published 4.5.4 - can you confirm that this issue has been resolved?

awsume-configure still fails, but now it's about setuptools:

~ ᐅ awsume-configure
Traceback (most recent call last):
  File "/Users/yuri/.local/bin/awsume-configure", line 5, in <module>
    from awsume.configure.main import main
  File "/Users/yuri/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/__init__.py", line 4, in <module>
    from awsume.configure import post_install
  File "/Users/yuri/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/post_install.py", line 1, in <module>
    from setuptools.command.install import install
ModuleNotFoundError: No module named 'setuptools'

In both cases I've installed awsume via pipx.

@znd4
Copy link
Contributor

znd4 commented Jun 14, 2024

pipx inject awsume setuptools

Is a workaround (at least for me)

@cspotcode
Copy link

I still see the distutils error on python 3.12, awsume 4.5.4.

❯ awsume --version
Warning: the awsume shell script is not being sourced, please use awsume-configure to install the alias
4.5.4
/home/ubuntu/.local/bin/awsume: line 183: return: can only `return' from a function or sourced script

❯ python --version
Python 3.12.3

❯ awsume-configure --version   
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/awsume-configure", line 5, in <module>
    from awsume.configure.main import main
  File "/home/ubuntu/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/__init__.py", line 4, in <module>
    from awsume.configure import post_install
  File "/home/ubuntu/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/post_install.py", line 1, in <module>
    from setuptools.command.install import install
  File "/home/ubuntu/.local/pipx/shared/lib/python3.10/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'

Is python broken and trying pull python 3.10 packages into 3.12? Python's package handling always feels like such a mess, I don't know if I'm supposed to be seeing 3.10 in those traceback paths or not.

@lhendrick-t10
Copy link
Collaborator

@cspotcode - digging back into this again. distutils was removed from Python 3.12 (deprecated in 3.10)

Looking into options to fix this in the distribution but for now separately injecting setuptools with pipx should shim until that fix can be implemented

@cspotcode
Copy link

@lhendrick-t10 unfortunately I already did pipx inject awsume setuptools, I still get the distutils error. I think the missing distutils is distinct from missing setuputils error.

@znd4
Copy link
Contributor

znd4 commented Aug 2, 2024

File "/home/ubuntu/.local/pipx/venvs/awsume/lib/python3.12/site-packages/awsume/configure/post_install.py", line 1, in
from setuptools.command.install import install
File "/home/ubuntu/.local/pipx/shared/lib/python3.10/site-packages/setuptools/init.py", line 10, in
import distutils.core

@cspotcode , it looks like python3.10's site-packages is ahead of your awsume site-packages. That seems like a pipx issue.

Based on this pipx docs page and testing on my machine, it seems like it's fine to upgrade pipx (sudo apt update && sudo apt upgrade pipx?), then

rm -rf ~/.local/pipx/shared/

awsume-configure might suddenly start working.

pipx will recreate this whenever you run pipx install again, so if you don't upgrade pipx, it's possible that it'll keep using 3.10. Good luck!

@cspotcode
Copy link

Thanks for taking a look. I ended up building a static binary which I can copy to all my machines. So I won't have time to debug my python installation.

Here's where I talked about the static binary, in case it's helpful to anyone else reading this in the future: #264 (comment)

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

Successfully merging a pull request may close this issue.

9 participants