awsume icon indicating copy to clipboard operation
awsume copied to clipboard

Can't get past the alias/sourcing error.

Open matale opened this issue 2 years ago • 11 comments

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.

matale avatar Oct 07 '23 20:10 matale

Also encountering the issue

thisKeeWord avatar Oct 23 '23 14:10 thisKeeWord

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

fauzanelka avatar Nov 15 '23 09:11 fauzanelka

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"

sethwrowan avatar Nov 21 '23 20:11 sethwrowan

this will/was resolved by https://github.com/trek10inc/awsume/pull/239

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

mtskillman avatar Nov 21 '23 22:11 mtskillman

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

lhendrick-t10 avatar Nov 22 '23 16:11 lhendrick-t10

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

lhendrick-t10 avatar Jan 06 '24 22:01 lhendrick-t10

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.

metametadata avatar Apr 07 '24 09:04 metametadata

pipx inject awsume setuptools

Is a workaround (at least for me)

znd4 avatar Jun 14 '24 18:06 znd4

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.

cspotcode avatar Jun 27 '24 17:06 cspotcode

@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

lhendrick-t10 avatar Jun 27 '24 17:06 lhendrick-t10

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

cspotcode avatar Jun 27 '24 18:06 cspotcode

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!

znd4 avatar Aug 02 '24 15:08 znd4

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: https://github.com/trek10inc/awsume/issues/264#issuecomment-2226989614

cspotcode avatar Aug 02 '24 16:08 cspotcode