No, you don't have to use the exact yarn recommended in the pattern, you can use any yarn that is the right thickness and gives you the correct number of stitches and rows per 4inch/10cm square for the pattern. However, it's worth understanding the characteristics of the recommended yarn. For example, a garment knitted with linen will typically grow in length when blocked and when worn so is knitted shorter than the same garment knitted in acrylic which doesn't grow in the same way. You can find suggested yarns at https://yarnsub.com or chat to the staff at your local yarn store, who will find a yarn to suit your pattern, your pocket and the right fibre for you. If you're allergic to wool, they could recommend an acrylic, cotton or other plant based yarn. If you are knitting from your stash, you could combine yarns, so two strands of yarn to make the equivalent of a heavier yarn. Always swatch to make sure it's not too stiff or too floppy a fabric when knitted.