[SOLVED] TypeError: rotate() got an unexpected keyword argument 'fillcolor'

I update my torch version from 1.3.1 to 1.4.0. But the trainloader created in prior version isn’t working in v1.4.0.
TypeError: rotate() got an unexpected keyword argument ‘fillcolor’

The above mentioned is the error. I visited the file functional.py line no - 729.
The last argument used fillcolor although in the function rotate its fill. I tried to make the changes but it didnt work.

Any help would be appreciated. Thanks

Could you check your PIL version?
This argument should be passed to PIL>=5 as seen here.

Thanks for your reply. The PIL version is 5.1.0. Also the return in the rotate function on my system is different than the one in the link you mentioned.
For me its:
return img.rotate(angle, resample, expand, center, fillcolor=fill)
Just now I uninstalled torch 1.4.0 and reinstalled it, but its the same.

Could you post a code snippet to reproduce this issue?
This code runs fine:

import torchvision.transforms.functional as TF

x = torch.randn(3, 224, 224)
img = TF.to_pil_image(x)
img = TF.rotate(img, 10)

I ran the code you mentioned. It throws the following error.

TypeError                                 Traceback (most recent call last)
<ipython-input-5-0f4eda8f5dd5> in <module>
----> 1 img = TF.rotate(img, 10)

/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py in rotate(img, angle, resample, expand, center, fill)
    727         fill = tuple([fill] * 3)
    728 
--> 729     return img.rotate(angle, resample, expand, center, fillcolor=fill)
    730 
    731 

TypeError: rotate() got an unexpected keyword argument 'fillcolor'

I retried the code with PyTorch 1.4.0 and torchvision=0.5.0 and it’s working fine.
Could you create a new environment and reinstall both libraries?

It’s working fine in the new environment. The PIL version is 7.0.0 in the environment. Updating the PIL version helped.

Thanks

Hi same error my versions are below,
torch 1.4.0+cpu
torchvision 0.5.0+cpu

Can you check the version of PIL? make sure its 7 or above. @Naveen

Hi raj thank you for reply. But I am not using PIL, I am trying to do these transformation in torch.utils.data.DataLoader.

I believe you didnt notice, that I was also doing the transformation thing. NOT using PIL. So can you verify the PIL version, as pytorch requires PIL.