C
C
che_aa2021-11-15 22:07:40
Python
che_aa, 2021-11-15 22:07:40

Psycopg2 won't download on python3.9?

Why doesn't psycopg2 download to python3.9?

What am I doing:

$python3.9 -m pip install psycopg2
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/33/ed/7943...
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 376, in prepare_files
discovered_reqs.extend(self._prepare_file(
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/__init__.py", line 14, in
from setuptools.dist import Distribution, Feature
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/dist.py", line 24, in
from setuptools.depends import Require
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/depends.py", line 7, in
from .py33compat import Bytecode
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/py33compat.py", line 54, in
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'


os ubuntu18.04

What I did to fix it and did not help:
pip3 install --upgrade pip
pip3 install --upgrade distlib
pip3 install --upgrade setuptools

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
che_aa, 2021-11-16
@che_aa

In general, this helped:

sudo apt install libpq-dev python3.9-dev
python3.9 -m pip install psycopg2-binary

S
Sergey Karbivnichy, 2021-11-15
@hottabxp

Try like this:python3.9 -m pip install psycopg2-binary

A
albert-gaynullin, 2021-11-16
@albert-gaynullin

pip install psycopg2-binary
this works on vps with ubuntu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question