Re: Installation of psycopg2

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Nitesh Jain <nitesh(dot)learning(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Installation of psycopg2
Date: 2018-02-05 11:51:26
Message-ID: CA+mi_8YDfisELq9fXN7H9Z5n4bP3-+11BoOOF-h-cXXPh32eAQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Mon, Feb 5, 2018 at 11:28 AM, Nitesh Jain <nitesh(dot)learning(at)gmail(dot)com> wrote:
> Hi Team,
>
> I am trying to connect to PostgreSQL from python.
> I have post PostgreSQL gres database version 8.1 and python 3.5 (earlier
> version for python 2.4, default installation on unix is also present)
>
> Direct internet connectivity from the organization is not allowed so I have
> to go through installation using setup.py.
>
> Now, I am facing issue when I run command
> python3.5 /usr/local/bin/psycopg2-2.7.3.2/setup.py install
>
> running build_ext building 'psycopg2._psycopg' extension creating
> build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/psycopg
> gcc*** command here In file included from psycopg/psycopgmodule.c:27:
> ./psycopg/psycopg.h:30:2: error: #error "Psycopg requires PostgreSQL client
> library (libpq) >= 9.1"
>
> I checked for path for pg_config is there in path variable as '/usr/bin/'.
>
> Can you suggest on below
> 1. How can I resolve this error?
> 2. why error say Psycopg instead of Psycopg2
> 3. will package work with PostgreSQL 8.1 database
>
> Your help will be much appreciated. Let me know if you any further inputs.
> Thanks in advance.

Hello Nitesh,

first, as a word of advice, PostgreSQL 8.1 is long unmaintained; it
would be better to update your servers to a maintained version. Anyway
I believe the choice is not yours, so let's go ahead.

Psycopg 2.7 depends on the postgres *client library* (libpq) version
>= 9.1, so packages such as postgresql-client and libpq-dev should be
at least this version. This is independent from your server version:
once you build successfully the library on the client you will be able
to connect to any server with version >= 7.4.

So, in order to solve your problem, either you install Psycopg 2.6, or
you install the postgres client package 9.1. Both solution are
something you have to do on the client. In both cases yes, you will be
able to connect and use a server 8.1.

What's in the error message is just a typo :)

Hope this helps

-- Daniele

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Nitesh Jain 2018-02-05 14:57:45 Re: Installation of psycopg2
Previous Message Nitesh Jain 2018-02-05 11:28:49 Installation of psycopg2