UniFrac distance is based on the phylogenetic tree you provided during data upload. If this tree is not found, the UniFrac (weighted or unweighted) will fail.
For microbiome data, phylogenetic trees can be generated using
- QIIME 2.0 pipeline (manual here)
- Mothur pipeline (manual here)