Cannot import name 'QuantStub' from ''

Hi I am new to pytorch.

I encounter an issue when I run the below. Can someone assist ?
from torchvision import datasets, transforms

Error message:
ImportError: cannot import name ‘QuantStub’ from ‘’

Are you seeing this error while just running from torchvision import datasets, transforms or any other imports?
Could you post the versions reported by pip list | grep torch and/or conda list | grep torch?

Hi ptrblck,
Thanks for reply. Someone suggested that I take away the .ao from all the error message files. So i just took away .ao from the below files and now there is no error message. Hope it really resolve the issue.


you probably have an older version of pytorch? we are deprecating the torch.quantization namespace, and is the recommended one

Hi Jerry,
Oh I see. May I know what version of pytorch & python should I install so that I can run pytorch smoothly?

1 Like