Visualizing PyTorch images and getting a session management error

I am trying to visualize PyTorch image tensors per loader (I have multiple data loaders) as follows:

validation_loaders = []

if len(validation_datasets)==5:
    for validation_dataset in validation_datasets:
        # print one image to sample the labels 
        im = dict['input1']
        plt.imshow(im.permute(1, 2, 0))


but I get this error:

Qt: Session management error: None of the authentication protocols specified are supported

I am running the code via ubuntu shell. I also tried to run it via visual studio terminal an in an ubuntu system. The problem is that I do not know where the problem stems from so I can debug it. Is this the correct way to visulize images or I need to do it differently? anyone faced a similar issue?
I appreciate the help.