Another update – I think we’ve found what’s going on here, and there’s a couple things.
- With the aforementioned python3.11/12 changes, some internal paths will be wrong, and since it uses those to check for the
os.py
install location, it will spit out those warnings. But they seem to be ignorable, as the actual paths needed are correct. It can be silenced by additionally settingPYTHONHOME
to$SNAP
. - The circular import error is caused by
charset_normalizer
looking for the private modulelib-dynload
, which for some reason lives inusr/lib/python3.12/lib-dynload
instead oflib/python3.12/lib-dynload
. It was lying about being a circular import error, it’s actually just a module not found error. As such, adding$SNAP/usr/lib/python3.12/lib-dynload
toPYTHONPATH
should fix that error. (I haven’t investigated why, but just adding$SNAP/usr/lib/python3.12
won’t work.) Further info and some other workarounds in case anyone wants to actually fix this: https://stackoverflow.com/questions/74182807/no-module-named-charset-normalizer-md-mypyc - For a bonus side note that I have not investigated deeply, for some reason if
python3-venv
is not specified instage-packages
(even if it is specified inbuild-packages
), it will not be available at build time. That seems illogical.
Some other helpful links that came up in the investigation process that I’m saving for posterity:
- just install whatever python you want Python 3.11 in Snap
- pep 405 python virtual environments https://peps.python.org/pep-0405/
- The new classic confinement in snaps The new classic confinement in snaps – Even the classics need a change | Snapcraft