To be lonely, then, is to desire an absent want. It is to feel an emptiness that remains unsatisfied — to feel isolated, in need, or abandoned, but with no one to help. Yet solitude is another thing altogether. To be solitary is to retreat into yourself, and to take great pleasure in your own company.

Source: Solitude is not loneliness. Here’s the key philosophical difference.