Almonds and walnuts are good alternatives as they have a similar texture and relatively subtle flavour.
I'd go with almonds personally, as walnuts can be a little bitter.
cooking.stackexchange.com/users/4194/ElendilTheTall
It's not even necessarily a substitution, as pesto is just a type of sauce made from a pounding up herbs and other stuff in a mortar & pestle.
It's just that most pesto that people see is the traditional 'basil pesto' aka 'pesto Genovese' which is garlic, oil, salt, basil and pine nuts, so they assume that it's the only 'pesto' ...
you can find plenty of recipes searching for: Pesto Sicilian Pesto
Trapanese Pesto Rosso Pesto Pantesco Pesto Calabrese
In terms of nuts, I've seen recipes calling for hazelnuts, almonds, pistachios, pine nuts, walnuts, or even a combination of multiple nuts.
I'm guessing they'd use whatever is abundant and in season in that particular region.
I've seen anchovies, capers or olives in place of straight salt; plenty of types of herbs, or even greens like spinach or arugula (aka rocket for the Brits).
(And on Good Eats, Alton Brown was a fan of pistachios in pesto; if I recall correctly, part of the argument was they were already green.)
cooking.stackexchange.com/users/67/Joe
I've used sunflower seeds in my home-made pesto for ages.
Salted or not as you prefer, they add the right little bit of crunch at a fraction of the cost of pine nuts.
cooking.stackexchange.com/users/5455/Wayfaring Stranger
Commercial pesto brands seem to quite often use cashew nuts, seemed odd to me, as cashew nuts are quite expensive.
Or you could just not use the nuts at all - would be more like a french pistou, but still good with pasta.
cooking.stackexchange.com/users/5212/Carl Gregory
It's very likely that someone allergic to pine nuts would also be allergic to walnuts and almonds (I am allergic to all of them, cashews, too).
I have used unsalted sunflower seeds, but most of the time I leave the pine nuts out and add more cheese or bread crumbs :)
cooking.stackexchange.com/users/10678/Val
I normally use toasted walnuts, but have had success with macadamia nuts as well.
I find pine nuts actually a bit low in flavor, in comparison to walnuts or macadamia nuts.
cooking.stackexchange.com/users/3819/Dave Griffith
Made pesto with oven toasted sunflower seeds, tasted great!!
Was not as creamy or buttery as pine nuts...but was a great and economical substitution!
cooking.stackexchange.com/users/33691/user33691
On occasion I will throw in some sesame seeds (hmm...
I wonder how tanini would work out?), but simply leaving out the nut component of a traditional basil pesto will yield a satisfying result, especially if all the other ingredients are fresh and top-shelf.
cooking.stackexchange.com/users/5389/gestep
Pine nuts are not actually nuts.
They are seeds found inside the structure of the pine cone.
Technically, sunflower seeds would provide the most similar flavor when looking for a pine nut substitution in traditional recipes.
Sesame seeds would also offer a solution to those with nut allergies that don't have pine nuts on hand.
cooking.stackexchange.com/users/55213/Rob Guthm
Cashews are much cheaper than pine nuts when bought in large quantities.
I usually make my own pesto (from pine nuts, though) and I'd recommend almonds or cashews (depending where you get them),
cashews if you want a more subtle taste.
cooking.stackexchange.com/users/5372/Jens
In addition to all of the great suggestions above, hazelnuts also work well.
Peel them first by toasting them and then using a towel or silicon pot holder to rub the skins off.
cooking.stackexchange.com/users/9842/Trey
I'm allergic to pine nuts, is there another nut I can use to make pesto?
What is a good pine nut substitute for pesto?
cooking.stackexchange.com
<substitutions><allergy><nuts>
cooking.stackexchange.com/questions/13336
cooking.stackexchange.com/users/5366/Sam Bee
Almonds, walnuts, pistachios, hazelnuts and especially cashews are good options, and are often cheaper than pine nuts. Pistachios are good as they are already green. Sunflower seeds would have a similar flavour. Other nuts include walnuts, cashew nuts, macadamia nuts  or hazelnuts.
Almonds, walnuts, pistachios, cashew nuts, macadamia nuts or a combination of nuts are all possible replacements. Sunflower seeds would have a similar flavour.