Error could not determine PostgreSQL version from 10.0

By unpinning psycopg2 in your requirements.txt file should resolve the could not determine PostgreSQL version from '10.0' error
Error could not determine PostgreSQL version from 10.0

Since 2016 I've been using python to develop a majority of my software solutions at my workplace. Namely, I've used Kotti, Django and other python frameworks for simple yet clean CMS applications. Each of these framework uses PostgreSQL as their database backend. In order for these python frameworks to interact with PostgreSQL it requires a connector, namely psycopg2. I've been using psycopg2 nearly two years now without any issues. However, the installation script broke during the testing phase for an application I've been maintaining for the last few months. I first noticed this a week ago when the Gitlab pipeline failed. I wasn't sure why it was failing at the moment, but after doing a bit of investigation I realized that the installation for psycopg2 broke and threw the following error:

Collecting psycopg2==2.6.1 (from -r requirements.txt (line 80))
  Downloading psycopg2-2.6.1.tar.gz (371kB)
    Complete output from command python 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: could not determine PostgreSQL version from '10.0'

It took me a while to understand what Error: could not determine PostgreSQL version from '10.0' meant. The only thing came close to the issue was a reported issue on Github. However, after doing some more research and investigation of the installation process and requirements, I realized that version for psycopg2 was already installed by another package while version 2.6.1 was trying to be installed. At this point, I had two options to solve this:

  1. Change the requirements for psycopg2 to be equal or greater than 2.6.1
  2. Unpin psycopg2

I went with the latter even though the installed version of psycopg2 may vary based on the system it is installed on. Nevertheless, all tests passed without any issue. If you're getting a similar error and unpinning is not working for you. Execute the pip list command to find out what was installed and if there is any version conflict occurring.

Go Back