This happened with:
/usr/bin/python bootstrap.py --python 312 --builder=cctbx --nproc=10 --use-conda --no-boost-src
libtbx_refresh.py in that branch imports the imp module which was removed in Python 3.12. This has been fixed years ago on dxtbx master.