@Mario_Parreno I wrote a new (slightly shorter) tutorial for installing PyTorch on RPi3.
Available here: https://gist.github.com/fgolemo/b973a3fa1aaa67ac61c480ae8440e754 345
I think in your case the crucial detail is that either

you forgot to export NO_DISTRIBUTED=1 or
you did sudo python setup.py install instead of sudo -E python setup.py install (notice the -E). If you don’t use the E flag, python will not receive the NO_DISTRIBUTED variable and attempt to build the gloo library which is needed for distributed computing.

Could you give it another try, please?