I have factory reset my iMac today. Installed latest Anaconda, created env, activated env, followed instructions here 1.
This is the error message I receive when I try to run any code with torch.
  File "torch.py", line 1, in <module>
    import torch
  File "/Users/reubenschmidt/code/python/nn/cxr_net/torch.py", line 3, in <module>
    x = torch.rand(5,3)
AttributeError: partially initialized module 'torch' has no attribute 'rand' (most likely due to a circular import)

Terminal conda list | grep torch result:
pytorch                   1.4.0                   py3.8_0    pytorch
torchvision               0.5.0                  py38_cpu    pytorch

This issue has been discussed previously here:

  
    
    
    AttributeError: module 'torch' has no attribute 'randn' 
  
  
    Thank you. I’m surprised I did exactly that twice as you said (bash-3.2$ pip uninstall torch), but returns the following: 
Skipping torch as it is not installed. 
You are using pip version 10.0.1, however version 18.1 is available. 
You should consider upgrading via the ‘pip install --upgrade pip’ command. 
import torch doesn’t return error, but throws error when importing other packages.
  


Any thoughts would be much appreciated. Cheers.