I had been running a custom numpad firmware for my 16, but the recent upgrades of course overwrote my changes. I’m finally getting around to redoing them, but I’m failing to make the firmware. When I do
qmk compile -kb framework/numpad -km default
it fails, seemingly because of this error:
File "/home/user/Documents/gits/qmk_firmware/lib/python/qmk/math.py", line 26, in _eval if isinstance(node, ast.Num): # <number> ^^^^^^^ AttributeError: module 'ast' has no attribute 'Num'
which I believe may have something to do with python versions. Does that sound right, and if so, how might one tell qmk to use an older version of python?
You’d want to create a virtualenv with the specific Python version that’s compatible. mise is an amazing tool for managing multiple versions of Python (and other SKDs & tools). As an alternative, you can create a QMK-specific Distrobox to install, configure and flash QMK in isolation from your host environment.
Got it done with a venv, though I must admit it took me a while to get it right. I’m new to doing such things, and it was not apparent to me that I had to install QMK inside the venv even though it was already installed, otherwise it kept using the current global Python version. So I had to:
Install an older Python: sudo dnf install python3.10
Create the venv: python3.10 -m venv .venv/qmkvenv
Activate it: source .venv/qmkvenv/bin/activate
Install QMK inside the venv: pip install qmk
Run setup: qmk setup
Install missing dependencies when it complained: .venv/qmkvenv/bin/python3.10 -m pip install -r /home/user/Documents/gits/qmk_firmware_custom/requirements.txt
And finally compile!
I don’t think I had to go all the way back to 3.10, but I think I saw hints that that may have been the version used for the last release, and is old enough that module ast still had the attribute Num. Wondering if others are running into this too, or if I caused this problem for myself somehow. I just did a pretty straightforward git clone and copied my changes into the new files. Maybe I missed a step?
I did this quite a while ago so I don’t recall exactly, but AFAICT, qmk setup should take care of everything. Once you’ve installed qmk cli and run qmk setup, you should be ready to brew.
The only exception to this, as best as I recall, is that you might have to create a venv manually if your environment has PIP_REQUIRE_VIRTUALENV=true.
At any rate, I’m glad you’re able to get this working!