pgcli
pgcli copied to clipboard
The 'psycopg2<2.8,>=2.7.4' distribution was not found
Description
After update to pgcli 2.1.0-3 from AUR it doesn't start anymore giving the error:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 791, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (psycopg2 2.8.1 (/usr/lib/python3.7/site-packages), Requirement.parse('psycopg2<2.8,>=2.7.4'), {'pgcli'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pgcli", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in <module>
@_call_aside
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'psycopg2<2.8,>=2.7.4' distribution was not found and is required by pgcli
Your environment
I'm using Manjaro Linux, pgcli is installed from AUR and have version 2.1.0-3, psycopg version is 2.8.1
I understand that I can solve the problem by downgrading psycopg to earlier version. However, I'd like to know if it's possible to fix it in pgcli. Is it difficult? Can I help?
For those who need a fast solution, downgrade psycopg to the latest compatible version:
pip install --user -U psycopg2==2.7.7
That's right, pgcli was not updated or tested with pscopg2==2.8 yet. I understand this is annoying, but as a temporary workaround, you could install pgcli into a venv, and keep psycopg2==2.8 system-wide.
Personally for me it's not a problem or blocker (I've already downgraded it globally, because I use venvs for projects anyways). I just thought that it'd be nice for other users of pgcli to end up in this page and find the solution if they face the same issue.
@Zebradil Sure, you're welcome to submit a PR to upgrade pgcli to psycopg2>=2.8. You may want to look at some related issues that talk about binary vs source package:
https://github.com/dbcli/pgcli/issues/849 https://github.com/dbcli/pgcli/issues/974 https://github.com/dbcli/pgcli/issues/844
The latest release of pgcli (3.5.0) requires psycopg>=3.0.14, so this issue is moot. Shall we close it?