Everyone is going to have people in their lives who are difficult to deal with, difficult to get along with. This is true for your professional life as well as your personal life. That is a given and what you do about it is the variable.
At a recent conference that I attended, one of the presentations was about this very subject. The speaker was Steve McClatcly of Alleer, a training and consulting company. What Steve advised in dealing with such situations was to focs on people's strengths and manage their weaknesses. We all have both and if you want to increase the number and percentage of people you call friends, this method works.
In a relationship, you focus on the strengths and manage the weaknesses. Then you build a like and an interest in the other person. Its not that your friends are perfect, you look for the things that you like and focus on those. Discover the things that you love about that person and make those the center of your attention. For the things that you don't like, manage those weaknesses even if it means not talking about them.
Of course there are people with whom it is difficult to impossible to cope with. Those are the ones that we need to minimize our time with. For the rest, keep the things in mind that you like about them. Keep in mind the good things that they do. De-emphasize their weaknesses or the things that bother you. This will work.