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 
        dict=validation_dataset.__getitem__(0)
        im = dict['input1']
        plt.imshow(im.permute(1, 2, 0))

        validation_loaders.append(DataLoader(
                    validation_dataset,
                    batch_size=args.batch_size,
                    shuffle=False,
                    drop_last=False,
                    **gpuargs))

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.