Why PyTorch fails to instantiate this neural network from Torch Hub?
I am on Ubuntu, running PyTorch 1.7.1 and torchvision 0.8.2:
print(torch.__version__)
print(torchvision.__version__)

&gt;&gt; 1.7.1
&gt;&gt; 0.8.2

When I attempt to instantiate resnet18 with:
model_resnet18 = torch.hub.load('pytorch/vision', 'resnet18', pretrained=True)

it fails with:
Using cache found in /home/stark/.cache/torch/hub/pytorch_vision_master
Traceback (most recent call last):
  File &quot;/home/stark/Work/test/binary_classifier.py&quot;, line 253, in &lt;module&gt;
    build_and_train()
  File &quot;/home/stark/Work/test/binary_classifier.py&quot;, line 174, in build_and_train
    model_resnet18 = torch.hub.load('pytorch/vision', 'resnet18', pretrained=True)
  File &quot;/home/stark/anaconda3/envs/torch-env/lib/python3.8/site-packages/torch/hub.py&quot;, line 370, in load
    model = _load_local(repo_or_dir, model, *args, **kwargs)
  File &quot;/home/stark/anaconda3/envs/torch-env/lib/python3.8/site-packages/torch/hub.py&quot;, line 396, in _load_local
    hub_module = import_module(MODULE_HUBCONF, hubconf_path)
  File &quot;/home/stark/anaconda3/envs/torch-env/lib/python3.8/site-packages/torch/hub.py&quot;, line 71, in import_module
    spec.loader.exec_module(module)
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
  File &quot;/home/stark/.cache/torch/hub/pytorch_vision_master/hubconf.py&quot;, line 14, in &lt;module&gt;
    from torchvision.models.mobilenetv2 import mobilenet_v2
ModuleNotFoundError: No module named 'torchvision.models.mobilenetv2'

I am on Python 3.8 and already on the latest PyTorch version, so what else can I do to fix this?
Any pointers are greatly appreciated!

You could use torchvision's API instead:
model_resnet18 = torchvision.models.resnet18(pretrained=True)

