pipenv cannot install psycopg2-binary, but pip can (py 3.8)
See original GitHub issueIssue description
I’m trying to bring a project using requirements.txt into using Pipfile. I am stumped by the fact that pipfile cannot install psycopg2-binary, but pip can. I’m using windows, and developers will not generally be simply able to build psycopg2 from sources.
Problem:
Create a pipenv using Python 3.8
calling pipfile install psycopg2-binary
Expected result
I’ll expect it to be installed to the virtualenv.
Actual result
We get the error
raise InstallationError(
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\kristjan\AppData\Local\Temp\tmp1wcw4j8zbuild\psycopg2-binary\
workaround:
calling pipenv run pip install psycopg2-binary
results in the package being installed.
But this is not adequate, because it means that Pipfile and Pipfile.lock can not be used to deploy the application any more.
Steps to replicate
On windows:
pipenv --python 3.8
pipenv install psycopg2-binary
Other
I am aware that psycopg2-binary is not considered optimal for production. However, for development on windows that is the only practical way to bring the driver in for regular users. I would be happy to have a separate requirement if running on linux with suitable prerequisites installed.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:26 (2 by maintainers)
Top GitHub Comments
Please don’t avoid this issue by closing it! The fact that pip (an inferior tool) can do this out-of-the-box while PipEnv cannot is a big pain point, especially considering the fact that a lot of beginner tutorials teach using “deploy to heroku with postgres” where this bug breaks everything and is off-putting for new learners (and potentially new users of pipenv).
For anyone continuing to run into this issue, go ahead and try using the new prerelease of pipenv (i.e.
pip install --upgrade --pre pipenv
) & make sure you have postgres client binaries installed (i.e. viasudo apt install libpq-dev
on ubuntu/debian for the minimal headers). I confirmed this on a fresh container and could not reproduce the issue with the headers installed. Without the headers, I saw a rather long error message, at the top of which I was instructed to install them.Closing for now, please file a new issue if the pre-release + installing appropriate client binaries or headers does not resolve this. Thanks!