There are many situations in which you may encounter this error when doing the import torch. Try following workarounds and see if any works for you:
- If you got this error when using Google Colab, try resetting the runtime.
- You can try to install Cython using
pip3 install Cythonand see if it helps in your situation.
- The error may also occur because you were in the wrong folder when doing the import. Change directory before calling
cd test python >>> import torch