Not sure, what is creating this error, as I’m using Spyder myself without ever seeing this error.
Could you check your working directory and make sure it’s not inside the PyTorch dir?
Also, could you create a new virtual environment and install PyTorch again with Spyder there?