def get_incompatible_reqs(dist, installed_dists):
    """Return all of the requirements of `dist` that are present in
    `installed_dists`, but have incompatible versions.

    """
    installed_dists_by_name = {}
    for installed_dist in installed_dists:
        installed_dists_by_name[installed_dist.project_name] = installed_dist
    for requirement in dist.requires():
        present_dist = installed_dists_by_name.get(requirement.project_name)
        if present_dist and present_dist not in requirement:
            yield requirement, present_dist
