Why do I get "Error: could not determine PostgreSQL version from '10.x'" when building psycopg2?

Issue

When building an app with psycopg2 as a dependency, you receive the error Error: could not determine PostgreSQL version from '10.x' in the build output when building the dependency.

Resolution

psycopg2 versions below 2.7 are incompatible with the version of libpq-dev used in the stack images on Heroku, as the pg_config utility returns a version format that cannot be parsed by earlier psycopg2 versions. To resolve this issue, you will need to upgrade psycopg2 to 2.7 and up.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support