Sagemath has a Docker image. . . Running Sagemath in a container (toolbox, podman, systemd-nspawn) with Fedora 39 would probably be ideal in this case since support is low on Fedora.
podman pull sagemath/sagemath
podman run sagemath/sagemath <command>
If you are on Fedora 39, and have toolbox installed would you consider trying to run the Docker image? Since you are on a version of Fedora I am currently not on. Since I am not familiar with the tool, you might have better insight if bugs are present from the build.