if you look at the error:
from pytorch_lightning.utilities.distributed import rank_zero_only:
you'll see that it is calling up folder names. So look in your venv.
Find the folder for pytorch_lightning. Open the folder "utilities". In this folder you should find "rank_zero".
Correct the import statement on the file in question.
Change the import statement:
old: from pytorch_lightning.utilities.distributed import rank_zero_only:
new:
from pytorch_lightning.utilites import rank_zero
Run the program again. It should run from here.
If you actually open up the rank_zero file you will see that it imports rank_zero_only from lightning_fabric.
If you just need the rank_zero_only file for your uses, you'll find it in this locaton: lightning_fabric.utilities.rank_zero
If you're interested in an alternate way to do what you need to do, you may want to check out lightning here: https://lightning.ai/docs/fabric/stable/