One thing I run into way too often with Python tooling is stuff like the following:
Traceback (most recent call last):
File "/opt/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 16, in <module>
import bootstrapping
File "/opt/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
^^^^^^^^^^^^
File "/opt/google-cloud-sdk/bin/bootstrapping/setup.py", line 57, in <module>
from googlecloudsdk.core.util import platforms
File "/opt/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
from googlecloudsdk.core.util import importing
File "/opt/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
If something changes on your host system (new Python version, wrong mix of package manager and pip modules, etc), things break. Python virtual environments help some, but it is a pain to remember what all virtual envs you have installed for various projects.
Perhaps a better solution is statically linked tooling in Go or Rust …
package management is hard, and entrusting the end-user to be able to handle it more often results in such errors and bad taste, one can argue that its empowering the end user by providing the choice what to install but it does have these kind of fallouts which is little fire everywhere and wears you out. So I think yes simpler setups always get adopted even though they might do such encapsulations with somewhat complexity, its worth it at times.
The error “ModuleNotFoundError: No module named ‘imp’” typically occurs in Python 3.4 and later versions because the imp module has been deprecated and replaced by importlib.
Updated google-cloud-sdk to latest, and how getting:
This server has Python3 3.6.9, and a working server has Python 3.9.2. Perplexity suggests:
Ansible Core 2.12 and later versions require Python 3.8 or newer on the control node (the machine where Ansible is run) .
Python 3.6 reached its end-of-life on December 23, 2021, and is no longer supported by the Python core team. Consequently, newer versions of Ansible do not support Python 3.6
So, I really need to keep my servers updated better …