Cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed'
I am using VQGAN+CLIP_(Zooming)_(z+quantize_method_with_addons).ipynb Google Repository and when I click the cell &quot;Loading of libraries and definitions&quot;
It sent an error :
ImportError                               Traceback (most recent call last)
&lt;ipython-input-6-fe8fafeed45d&gt; in &lt;module&gt;
     24 from omegaconf import OmegaConf
     25 from PIL import Image
---&gt; 26 from taming.models import cond_transformer, vqgan
     27 import torch
     28 from torch import nn, optim

1 frames
/content/taming-transformers/main.py in &lt;module&gt;
     10 from pytorch_lightning.trainer import Trainer
     11 from pytorch_lightning.callbacks import ModelCheckpoint, Callback, LearningRateMonitor
---&gt; 12 from pytorch_lightning.utilities.distributed import rank_zero_only
     13 
     14 from taming.data.utils import custom_collate

ImportError: cannot import name 'rank_zero_only' from 'pytorch_lightning.utilities.distributed' (/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/distributed.py)

I don't know how to solde this problem. I don't know how to manually install Pytorch as it said &quot;NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
&quot;Open Examples&quot; button below.&quot;
Thank you in advance if you have the solution.
Inès
I triad !pip install but I may not really know where to put this cell/line of code

pytorch_lightning has recently released a new version which will throw this error (version 1.8.0.post1 released on November 2nd 2022).
https://pypi.org/project/pytorch-lightning/#history
Just install an older version of pytorch_lightning and it will work.
In my system, I ran &quot;pip install pytorch-lightning==1.6.5&quot;, higher versions may work as well, you can check them out by clicking on the link provided above and then clicking on release history.
