Just an addition to wsaleem's answer, as I'm not allowed to comment.
Reinstalling with M-x elpy-rpc-reinstall-virtualenv
helped in my case, most likely because the python version has changed and so has the path for python. In my case from 3.12 to 3.13.