awscli v2.34.3 on FreeBSD 15.0: _awscrt shenanigans

I had been running AWS CLI v2 on FreeBSD for a while, and it stopped working after I updated to the latest release. I checked out v2.34.3 from the awscli v2 repo, installed the dependencies from requirements.txt, making sure there were no conflicts with locally installed packages — in particular awscrt, where I used the latest available version as specified in the requirements. The aws command itself ran fine:

» aws --version
aws-cli/2.34.3 Python/3.11.14 FreeBSD/15.0-RELEASE-p2 source/amd64

But as soon as it needed to do anything real, it fell apart:

» aws configure sso

aws: [ERROR]: module '_awscrt' has no attribute 'set_log_level'

A bit of digging showed awscrt/io.py calling _awscrt.set_log_level(log_level).

For some context, the awscrt package is the AWS Common Runtime binding for Python, and it’s split into two parts. The pure Python layer lives in the awscrt package and handles the high-level API. The actual work is done by _awscrt, a C extension compiled as a library (a .so file) which on a typical FreeBSD + Python 3.11 setup would live at /usr/local/lib/python3.11/site-packages/_awscrt.abi3.so.

I had manually installed awscrt==0.31.2, the latest release at the time of writing, and also exactly the version pinned in awscli’s requirements.txt. Still, the error persisted. The Python wrapper was clearly calling something the .so didn’t expose.

The clue came from checking where Python was actually loading things from:

» python3 -c "import awscrt; print(awscrt.__version__, awscrt.__file__)"
0.31.2 /usr/local/lib/python3.11/site-packages/awscrt/__init__.py
» python3 -c "import _awscrt; print(_awscrt.__file__)"
/home/myuser/.local/lib/python3.11/site-packages/_awscrt.abi3.so

There it is. The Python part of awscrt was correctly loading from the system-wide site-packages. But _awscrt, the compiled extension, was being pulled from my user’s local site-packages. Probably a leftover from a previous install that I hadn’t properly cleaned up.

After removing the dangling file from ~/.local/lib/python3.11/site-packages/, the check came back clean:

» python3 -c "import _awscrt; print(_awscrt.__file__)"
/usr/local/lib/python3.11/site-packages/_awscrt.abi3.so

And with that, aws configure sso ran without complaint.

GTranslate and Weboob

This is a quick interface to translation tools. In particular it was made to interface a specific tool from Weboob. For those who don’t know Weboob is a collection of applications able to interact with websites without a browser and mostly from command line interfaces. This allows GTranslate to use web translation services such as Google-Translate. However it can also be used with others translation tools as long as they offer a simple command-line way to translate a text from one language to another. It can also be easily adapted to any tool to provide an interactive conversion from one type to another. I made this tool to try out GTK-3 and GtkBuilder and actually building interfaces with Glade is really easier.

You may found the github page at http://github.com/gawen947/gtranslate.
And a small project page at http://www.hauweele.net/~gawen/gtranslate.html.

GTranslate

Speaking about Weboob I think this is a very good initiative because I’m getting a bit sick of these overpowered web-browsers outshining the application landscape. I mean we should tend toward a web of services but instead we just spend our time recoding everything we already had in JavaScript and shiny HTML5 interfaces. And I think, or rather hope that the future of web lies outside the browsers.