Solved by hhh in post #2 
              
              
                It seems that it is because I used conda to install PyTorch and used pip to install the spacy library. When I used conda to install both of them it worked.