Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

Discussion in 'Python' started by Pascal Polleunus, Oct 4, 2010.

  1. Hi,

    I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04.


    My problem is also explained on stackoverflow:
    http://stackoverflow.com/questions/3847536/installing-psycopg2-in-virtualenv-ubuntu-10-04-python-2-5


    I tried different things explained there:
    http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/

    The last thing I tried is this...
    I created a virtualenv with -p python2.5 --no-site-packages
    I installed libpq-dev: apt-get install libpq-dev

    In the virtualenv, I did this: easy_install -i
    http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base

    Then when I tried pip install psycopg2==2.0.7, I got this error:

    Installing collected packages: psycopg2
    Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
    -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
    -DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404
    -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
    -DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5 -I.
    -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c
    psycopg/psycopgmodule.c -o
    build/temp.linux-i686-2.5/psycopg/psycopgmodule.o
    -Wdeclaration-after-statement
    psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
    In file included from psycopg/psycopgmodule.c:31:
    ../psycopg/python.h:31:26: error: structmember.h: No such file or directory
    ../psycopg/python.h:34:4: error: #error "psycopg requires Python >= 2.4"
    In file included from psycopg/psycopgmodule.c:32:


    Does anyone have any idea how to solve that?

    Thanks in advance,
    Pascal
     
    Pascal Polleunus, Oct 4, 2010
    #1
    1. Advertising

  2. Pascal Polleunus <> writes:

    > Hi,
    >
    > I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04.
    >
    >
    > My problem is also explained on stackoverflow:
    > http://stackoverflow.com/questions/3847536/installing-psycopg2-in-virtualenv-ubuntu-10-04-python-2-5
    >
    >
    > I tried different things explained there:
    > http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/
    >
    > The last thing I tried is this...
    > I created a virtualenv with -p python2.5 --no-site-packages
    > I installed libpq-dev: apt-get install libpq-dev
    >
    > In the virtualenv, I did this: easy_install -i
    > http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base
    >
    > Then when I tried pip install psycopg2==2.0.7, I got this error:
    >
    > Installing collected packages: psycopg2
    > Running setup.py install for psycopg2
    > building 'psycopg2._psycopg' extension
    > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
    > -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
    > -DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404
    > -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
    > -DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5
    > -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c
    > psycopg/psycopgmodule.c -o
    > build/temp.linux-i686-2.5/psycopg/psycopgmodule.o
    > -Wdeclaration-after-statement
    > psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
    > In file included from psycopg/psycopgmodule.c:31:
    > ./psycopg/python.h:31:26: error: structmember.h: No such file or directory
    > ./psycopg/python.h:34:4: error: #error "psycopg requires Python >= 2.4"
    > In file included from psycopg/psycopgmodule.c:32:
    >
    >
    > Does anyone have any idea how to solve that?


    Install the python-dev-package. It contains the Python.h file, which the
    above error message pretty clearly says. Usually, it's a good idea to
    search package descriptions of debian/ubuntu packages for missing header
    files to know what to install.

    Diez
     
    Diez B. Roggisch, Oct 4, 2010
    #2
    1. Advertising

  3. Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python2.5)

    On 05/10/10 00:11, Diez B. Roggisch wrote:
    > Pascal Polleunus<> writes:
    >
    >> Hi,
    >>
    >> I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04.
    >>
    >>
    >> My problem is also explained on stackoverflow:
    >> http://stackoverflow.com/questions/3847536/installing-psycopg2-in-virtualenv-ubuntu-10-04-python-2-5
    >>
    >>
    >> I tried different things explained there:
    >> http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/
    >>
    >> The last thing I tried is this...
    >> I created a virtualenv with -p python2.5 --no-site-packages
    >> I installed libpq-dev: apt-get install libpq-dev
    >>
    >> In the virtualenv, I did this: easy_install -i
    >> http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base
    >>
    >> Then when I tried pip install psycopg2==2.0.7, I got this error:
    >>
    >> Installing collected packages: psycopg2
    >> Running setup.py install for psycopg2
    >> building 'psycopg2._psycopg' extension
    >> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
    >> -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
    >> -DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404
    >> -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
    >> -DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5
    >> -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c
    >> psycopg/psycopgmodule.c -o
    >> build/temp.linux-i686-2.5/psycopg/psycopgmodule.o
    >> -Wdeclaration-after-statement
    >> psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
    >> In file included from psycopg/psycopgmodule.c:31:
    >> ./psycopg/python.h:31:26: error: structmember.h: No such file or directory
    >> ./psycopg/python.h:34:4: error: #error "psycopg requires Python>= 2.4"
    >> In file included from psycopg/psycopgmodule.c:32:
    >>
    >>
    >> Does anyone have any idea how to solve that?

    >
    > Install the python-dev-package. It contains the Python.h file, which the
    > above error message pretty clearly says. Usually, it's a good idea to
    > search package descriptions of debian/ubuntu packages for missing header
    > files to know what to install.


    It's already installed; at least for 2.6, nor sure it's correct for 2.5.
    python2.5-dev is not available but python-old-doctools replaces it.

    Here's what is installed:

    ii python2.5 2.5.4-1ubuntu6.1
    ii python2.5-minimal 2.5.4-1ubuntu6.1
    ii python-old-doctools 2.5.5-1
    ii python2.6 2.6.5-1ubuntu6
    ii python2.6-dev 2.6.5-1ubuntu6
    ii python2.6-minimal 2.6.5-1ubuntu6
    ii python-dev 2.6.5-0ubuntu1
     
    Pascal Polleunus, Oct 5, 2010
    #3
  4. Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

    Pascal Polleunus <> writes:

    > On 05/10/10 00:11, Diez B. Roggisch wrote:
    >> Pascal Polleunus<> writes:
    >>
    >>> Hi,
    >>>
    >>> I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04.
    >>>
    >>>
    >>> My problem is also explained on stackoverflow:
    >>> http://stackoverflow.com/questions/3847536/installing-psycopg2-in-virtualenv-ubuntu-10-04-python-2-5
    >>>
    >>>
    >>> I tried different things explained there:
    >>> http://www.saltycrane.com/blog/2009/07/using-psycopg2-virtualenv-ubuntu-jaunty/
    >>>
    >>> The last thing I tried is this...
    >>> I created a virtualenv with -p python2.5 --no-site-packages
    >>> I installed libpq-dev: apt-get install libpq-dev
    >>>
    >>> In the virtualenv, I did this: easy_install -i
    >>> http://downloads.egenix.com/python/index/ucs4/ egenix-mx-base
    >>>
    >>> Then when I tried pip install psycopg2==2.0.7, I got this error:
    >>>
    >>> Installing collected packages: psycopg2
    >>> Running setup.py install for psycopg2
    >>> building 'psycopg2._psycopg' extension
    >>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
    >>> -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
    >>> -DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404
    >>> -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
    >>> -DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5
    >>> -I. -I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c
    >>> psycopg/psycopgmodule.c -o
    >>> build/temp.linux-i686-2.5/psycopg/psycopgmodule.o
    >>> -Wdeclaration-after-statement
    >>> psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
    >>> In file included from psycopg/psycopgmodule.c:31:
    >>> ./psycopg/python.h:31:26: error: structmember.h: No such file or directory
    >>> ./psycopg/python.h:34:4: error: #error "psycopg requires Python>= 2.4"
    >>> In file included from psycopg/psycopgmodule.c:32:
    >>>
    >>>
    >>> Does anyone have any idea how to solve that?

    >>
    >> Install the python-dev-package. It contains the Python.h file, which the
    >> above error message pretty clearly says. Usually, it's a good idea to
    >> search package descriptions of debian/ubuntu packages for missing header
    >> files to know what to install.

    >
    > It's already installed; at least for 2.6, nor sure it's correct for 2.5.
    > python2.5-dev is not available but python-old-doctools replaces it.


    It is 100% *not* correct for python2.5. As the error message shows -
    it's missing.


    If it's not available somewhere, you should consider building python
    yourself, if you have to use 2.5.

    Diez
     
    Diez B. Roggisch, Oct 5, 2010
    #4
  5. Pascal Polleunus

    Alex Willmer Guest

    On Oct 5, 7:41 am, Pascal Polleunus <> wrote:
    > On 05/10/10 00:11, Diez B. Roggisch wrote:
    > > Install the python-dev-package. It contains the Python.h file, which the
    > > above error message pretty clearly says. Usually, it's a good idea to
    > > search package descriptions of debian/ubuntu packages for missing header
    > > files to know what to install.

    >
    > It's already installed; at least for 2.6, nor sure it's correct for 2.5.
    > python2.5-dev is not available but python-old-doctools replaces it.


    Ubuntu 10.04 doesn't have a full Python 2.5 packaged, as evidenced by
    the lack of python2.5-dev. You need to use Python 2.6 or if you
    absolutely must use Python 2.5 build it from source, try a Debian
    package or switch distro. python-old-doctools does not replace python-
    dev, it looks like it was bodged to keep some latex tools working.

    Regards, Alex
     
    Alex Willmer, Oct 5, 2010
    #5
  6. Re: Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python2.5)

    On 05/10/10 10:18, Alex Willmer wrote:
    > On Oct 5, 7:41 am, Pascal Polleunus<> wrote:
    >> On 05/10/10 00:11, Diez B. Roggisch wrote:
    >>> Install the python-dev-package. It contains the Python.h file, which the
    >>> above error message pretty clearly says. Usually, it's a good idea to
    >>> search package descriptions of debian/ubuntu packages for missing header
    >>> files to know what to install.

    >>
    >> It's already installed; at least for 2.6, nor sure it's correct for 2.5.
    >> python2.5-dev is not available but python-old-doctools replaces it.

    >
    > Ubuntu 10.04 doesn't have a full Python 2.5 packaged, as evidenced by
    > the lack of python2.5-dev. You need to use Python 2.6 or if you
    > absolutely must use Python 2.5 build it from source, try a Debian
    > package or switch distro. python-old-doctools does not replace python-
    > dev, it looks like it was bodged to keep some latex tools working.



    Thanks Diez and Alex for you quick answers.

    I finally used Python 2.6 and everything went fine.
     
    Pascal Polleunus, Oct 5, 2010
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SPE - Stani's Python Editor
    Replies:
    1
    Views:
    459
    SPE - Stani's Python Editor
    Apr 29, 2008
  2. nbv4
    Replies:
    1
    Views:
    813
    Rolando Espinoza La Fuente
    Mar 19, 2010
  3. ASh
    Replies:
    10
    Views:
    2,443
    Anton Shishkov
    Mar 31, 2010
  4. mrdrew
    Replies:
    5
    Views:
    2,752
    Dennis Lee Bieber
    Apr 5, 2010
  5. Gelonida N
    Replies:
    4
    Views:
    983
    Gelonida N
    Aug 11, 2011
Loading...

Share This Page