tl; dr: run:
sudo apt install libpq-dev python-dev
or the moral equivalent on your platform.
Further info on install docs.
Original below.
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file '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 setup.py 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
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JRYU0a/psycopg2/
You are using pip version 9.0.3, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I am hoping this is my issue with pip .. haven't gotten to debugging it correctly. But I assume its happening because of something in my pyenv
I am using py 3.6.8, over pyenv with pip version as indicated above.
Surprizingly, when I switch to version 2.7.7 things work fine.
Is there some hard dependency added to pip versions?
Surprizingly, when I switch to version
2.7.7things work fine.Is there some hard dependency added to
pip versions?
I am having the same issue :(
Fixed with:sudo apt-get install libpq-dev python-dev
The message explains it well.
If you read the documentation, as suggested by the message, you will be told to install certain packages (libpq-dev, python-dev, most likely).
This is the install documentation you were advised to read.
The warning you get installing 2.7 says "The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead.", which should have been pretty explanatory, if you don't ignore it.
Install the package psycopg2-binary instead of psycopg2. Or install the required dependencies.
ok thanks @dvarrazzo for the clarification.
The software versioning semantic is generally as follows : MAJOR#.MINOR#.PATH#, I am assuming this change from psycopg2 -> psycopg2-binary could have been handled with a MAJOR# upgrade.
Reference : https://semver.org/
Binary packages are broken for certain workloads. Being installed by default was a broken behaviour. As far as I'm concerned we could have done it in a patch release. Instead we gave one year of warning to apply changes.
How did you specify psycopg in your project's requirements file?
my requirements.txt contained psycopg2... which i later changed to psycopg2==2.7.7 to solve the problem.
I definitely had not read through the changes history & previos warnings. But I understand you had a strong reason to change it.
So, tell me, even if we changed our major version, and released psycopg2 version 3.0, wouldn't your project have been affected anyway?
:), no ..
but the issue at hand which I want to understand better is the change to psycopg2-binary. I understand the broken binary package is equivalent to a broken behavior. But I think separating that feature assuming its a broken behavior for certain workloads may have been the cause of troubles here. Because certain workloads is relative :), for me it was working - and it would have continued to work - had it stayed without the separation.
Its just philosophy we are discussing here (pls don't take offense :)). Now that I know what has changed - its easy to move ahead knowing this. You also mentioned you gave 1yr of warning to apply this, which I clearly missed.
So, no offence taken from me, but isn't a bit preposterous to come here complaining we didn't apply semver in an a*al retentive way when it wouldn't have helped shortcomings on your side, such as:
psycopg2>=2.7,<2.8 once you verified 2.7.x was working,Don't you think that "it works for me, so I don't care about the others" is a relatively short-sighted view for a project that is pretty much a worldwide industry standard?
Happy to talk about philosophy, there's beer for that and you are invited to offer me one if you happen around West London. I don't think there's much to add to this bug thought.
Surprizingly, when I switch to version
2.7.7things work fine.
Is there some hard dependency added topip versions?I am having the same issue :(
Fixed with:sudo apt-get install libpq-dev python-dev
Thanks, it's working because of your solution.
It will be good if psycopg2 will check is libpq-dev installed in system before installation and displays message if not.
Surprizingly, when I switch to version
2.7.7things work fine.
Is there some hard dependency added topip versions?I am having the same issue :(
Fixed with:sudo apt-get install libpq-dev python-dev
Thx..
Surprizingly, when I switch to version
2.7.7things work fine.
Is there some hard dependency added topip versions?I am having the same issue :(
Fixed with:sudo apt-get install libpq-dev python-dev
Successfully work, Thanks
Most helpful comment
I am having the same issue :(
Fixed with:
sudo apt-get install libpq-dev python-dev