I think the best way to install any package or library is by using its official guide on their websites.
I have also had a lot of troubles with installing packages, but in general, the official installation instruction remains the best.
For PyTorch installation, you can use these commands
pip3 install torch torchvision torchaudio
Or, if you are using conda instead of pip, you can run the following.
conda install pytorch torchvision torchaudio -c pytorch
All those commands are taken from the Official PyTorch Installation webpage.