Fix Pip Error – TypeError: unorderable types: NoneType() < str()

If you haven’t upgraded your pip/pip3 yet, you might be having a difficulty in installing packages or modules for python3+ like below:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/pip/", line 232, in main
    status =, args)
  File "/usr/lib/python3.4/site-packages/pip/commands/", line 339, in run
  File "/usr/lib/python3.4/site-packages/pip/req/", line 229, in prepare_files
  File "/usr/lib/python3.4/site-packages/pip/req/", line 931, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(self.req)
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 461, in get_distribution
    dist = get_provider(dist)
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 341, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 870, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 740, in resolve
    env = Environment(self.entries)
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 927, in __init__
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 957, in scan
  File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/", line 977, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: NoneType() < str()

To fix this, in my case for python3.4 (Distro: Manjaro), edit of pip package:

# edit this file
# look for lines
# and change these lines to
self.py_version or '',
self.platform or '',

You may take a look at this commit: c995677d5321.

The above solution is manual. You may also upgrade pip itself.

sudo pip install --upgrade pip