Debian 10 Instance Pip3 Error for certain packages
Hello,
I recently created a new Debian 10 instance, and when I try to use it to install certain packages, I am getting this error. It also happens if I try to update the pip3: sudo -H pip3 install --upgrade pip
Any ideas for why? Thank you.
root@23-239-0-182:~# pip3 install beautifulsoup4
Collecting beautifulsoup4
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
1 Reply
I just tried this out on a fresh Debian 10 install as well and was unable to recreate the issue. Here were my versions:
python3 --version
Python 3.7.3
pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
For the record, I used sudo apt install python3-pip
to install pip. When I ran the installation command for beautifulsoup4, this was the output:
root@localhost:~# pip3 install beautifulsoup4
Collecting beautifulsoup4
Downloading https://files.pythonhosted.org/packages/9c/d8/909c4089dbe4ade9f9705f143c9f13f065049a9d5e7d34c828aefdd0a97c/beautifulsoup4-4.11.1-py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 7.3MB/s
Collecting soupsieve>1.2 (from beautifulsoup4)
Downloading https://files.pythonhosted.org/packages/16/e3/4ad79882b92617e3a4a0df1960d6bce08edfb637737ac5c3f3ba29022e25/soupsieve-2.3.2.post1-py3-none-any.whl
Installing collected packages: soupsieve, beautifulsoup4
Successfully installed beautifulsoup4-4.11.1 soupsieve-2.3.2.post1
My suggestion is to make sure all your packages are up to date with sudo apt update -y && sudo apt upgrade -y
then try the install again. If that doesn't work, you may want to upgrade to the latest version of Python if you haven't already.