question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv cannot install psycopg2-binary, but pip can (py 3.8)

See original GitHub issue

Issue 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:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
utk-devcommented, Aug 7, 2021

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).

5reactions
techalchemycommented, Apr 29, 2020

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. via sudo 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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv - ERROR: Couldn't install package: psycopg2
Even after this, my Pipfile.lock got correctly updated with the new version of sentry-sdk and its dependencies, but I would like to get...
Read more >
gemnasium-python fails to install psycopg2-binary v2.9.2 with ...
When integrating Dependency Scanning into a Python project, the job will fail at installing psycopg2-binary 2.9.2 with pipenv.
Read more >
installing psycopg2-binary (2.9.3): failed - You.com
I am trying to add the psycopg2 module to my kivy-ios Xcode project but the toolchain can't build it. I ran 'python toolchain.py...
Read more >
psycopg2-binary - PyPI
psycopg2 - Python-PostgreSQL Database Adapter. ... pip install psycopg2-binary ... you can install psycopg like any other Python package, using pip to ...
Read more >
Installation — Psycopg 2.9.5 documentation
pip install psycopg2-binary. This will install a pre-compiled binary version of the module which does not require the build or runtime prerequisites ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found