Skip to content
Sign upLog in
← Back to Community
Trouble installing psycopg2
Profile icon
has Hacker Plan

I wanna use MQTT but I cannot install a dependency:

  • psycopg2 (2.8.6)

Command ['/opt/virtualenvs/python3/bin/pip', 'install', '--no-deps', 'psycopg2==2.8.6'] errored with the following return code 1, and output:
Collecting psycopg2==2.8.6
Using cached
ERROR: Command errored out with exit status 1:
command: /opt/virtualenvs/python3/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-__sklf4u/psycopg2/'"'"'; file='"'"'/tmp/pip-install-__sklf4u/psycopg2/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-__sklf4u/psycopg2/pip-egg-info
cwd: /tmp/pip-install-__sklf4u/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-install-__sklf4u/psycopg2/pip-egg-info/psycopg2.egg-info
writing /tmp/pip-install-__sklf4u/psycopg2/pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-install-__sklf4u/psycopg2/pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-install-__sklf4u/psycopg2/pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file '/tmp/pip-install-__sklf4u/psycopg2/pip-egg-info/psycopg2.egg-info/SOURCES.txt'

Error: pg_config executable not found. pg_config is required to build psycopg2 from source. Please add the directory containing pg_config to the $PATH or specify the full executable path with the option: python build_ext --pg-config /path/to/pg_config build ... or with the pg_config option in 'setup.cfg'. If you prefer to avoid building psycopg2 from source, please install the PyPI 'psycopg2-binary' package instead. For further information please check the 'doc/src/install.rst' file (also at <>). ----------------------------------------

ERROR: Command errored out with exit status 1: python egg_info Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

exit status 1

Profile icon
Profile icon

What system do you use to install it? And what is the architecture of the original system? Did you manage to solve the problem by reinstalling it? I have seen something like this happen on a system using mqtt broker high availability, but it did not take a programmer long to fix it. It was something about variable numbers in the code. I could not understand the core reason for the error, but it never occurred again, so I didn’t have to deal with it anymore. So, I would not say it’s a common problem because it was the only case it occurred in my practice.

Profile icon

maybe it's not available in Try installing again. IF it doesn't work, then it's not available in