0

So the other day, while trying to install a pip package for a project, I noticed that I was getting error messages. I tried anything that I could think of, even uninstalling python and pip, and reinstalling. Sadly, I am out of ideas and have no viable backup for my machine. Any suggestions?

The error I get for every package I try to install

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting defusedxml
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 338, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 102, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 256, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 218, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 164, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 572, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 534, in find_all_candidates
    self._package_versions(page.iter_links(), search)
  File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 702, in _package_versions
    v = self._link_package_versions(link, search)
  File "/usr/lib/python3/dist-packages/pip/_internal/index.py", line 777, in _link_package_versions
    support_this_python = check_requires_python(link.requires_python)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/packaging.py", line 33, in check_requires_python
    return python_version in requires_python_specifier
  File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/specifiers.py", line 676, in __contains__
    return self.contains(item)
  File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/specifiers.py", line 681, in contains
    item = parse(item)
  File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/version.py", line 28, in parse
    return Version(version)
  File "/usr/share/python-wheels/packaging-19.0-py2.py3-none-any.whl/packaging/version.py", line 219, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
2
  • Welp, for anyone having the same issue just try sudo pip Commented Mar 11, 2022 at 14:48
  • If you uninstalled python and don't have a backup do a fresh install. Your system is broken.
    – Milliways
    Commented Mar 11, 2022 at 21:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.