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 …
Lastest saga with Google GCP gsutil while trying to upload a new firmware image for a product to Google cloud:
Error: gsutil requires Python version 3.8-3.12, but a different version is installed.
You are currently running Python 3.13
(And this is after updating gsutil to the latest version)
Guess Arch is too cutting edge, Python breaks backwards compatibility too often, and Google does keep their tools up to date with the latest Python release.
So, I’m done with Python based gsutil – switching to rclone (written in Go).
In general, I’m becoming less and less enamored with cloud services for simple stuff. Unless you specifically need something they offer, cloud servers only add complexity compared to scp’ing the file to a server and fronting with Caddy or something. Self-hosting is sometimes simpler – especially over the long term.
It looks like gsutil is being deprecated for gcloud …
Upgrading from Python 3.13 to 3.14 breaks my venv:
● Bash(~/py/bin/pip --version 2>&1)
⎿ Error: Exit code 1
Traceback (most recent call last):
File "/home/cbrake/py/bin/pip", line 3, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
Claude suggests:
● Found the issue. Your system updated from Python 3.13 to 3.14, but your venv was created with 3.13. The pip packages are in the 3.13 site-packages which Python 3.14 can't see.
You'll need to recreate the venv:
# Save your installed packages first
~/py/bin/python -m pip freeze > ~/py-requirements.txt 2>/dev/null || true
# Or check if you can read from the old site-packages
ls ~/py/lib/python3.13/site-packages/ | head
# Remove and recreate the venv
rm -rf ~/py
python -m venv ~/py
# Reinstall packages
source ~/py/bin/activate
pip install -r ~/py-requirements.txt
Of course the above does not work.
I’m coming to the conclusion that to depend on Python for anything reasonably complex, it needs to go into a container.