ImportError: No module named 'torch'

I have installed torch in a virtual environment in a cluster server. By still import torch throws “ImportError: No module named ‘torch’”. How do I fix this issue?

Make sure that you are running the script from the right environment (the conda env name should be shown in the terminal).
You could also check, if torch is found via conda list | grep torch, which should output the install torch version.

1 Like

Hay,

Thank you for the reply. I was able to fix the issue!! I was using different environment, while importing torch.

Thank you for the reply!!