This project is archived and is in readonly mode.

#18 ✓resolved
Psycopg website

pip -e /path/to/psycopg2: psycopg/connection_type.c:810: error: ‘psyco_conn_get_exception’ undeclared here (not in a function)

Reported by Psycopg website | November 17th, 2010 @ 07:09 PM

Submitted by: Jeff Kowalczyk

When I try to build psycopg2 with a pip -e /path/to/psycopg2, I get the following error:

psycopg/connection_type.c:810: error: 'psyco_conn_get_exception' undeclared here (not in a function)

error: command 'gcc' failed with exit status 1

This error is consistent for psycopg versions 2.2.2, 2.3.0_beta1, and git.

Using the alternative install method works fine, I'm using a virtualenv, BTW:

(cd /path/to/psycopg2 && python setup.py install)

To keep the environment reproducible on multiple platforms, the virtualenvs use non-system pythons, e.g. an /opt/python2x. These are built with zc-buildout 1.4.4, zc.cmmi recipe:

cat /opt/python27/buildout.cfg

[buildout] parts = python
parts-directory = .
download-cache = cache

[python] recipe = zc.recipe.cmmi
url = http://www.python.org/ftp/python/2.7.1/Python-2.7.1rc1.tgz
extra_options = --enable-unicode=ucs2

The complete pip log is below:


/path/to/acme/bin/pip run on Wed Nov 17 11:06:48 2010 Obtaining file:///path/to/psycopg2
Running setup.py egg_info for package from file:///path/to/psycopg2

running egg_info
writing psycopg2.egg-info/PKG-INFO
writing top-level names to psycopg2.egg-info/top_level.txt
writing dependency_links to psycopg2.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'psycopg2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.js' under directory 'doc'
warning: no files found matching '*' under directory 'doc/html'
no previously-included directories found matching 'doc/src/_build'
warning: no files found matching 'PKG-INFO'
warning: no files found matching 'MANIFEST'
writing manifest file 'psycopg2.egg-info/SOURCES.txt'

Installing collected packages: psycopg2
Running setup.py develop for psycopg2

Running command /path/to/acme/bin/python -c "import setuptools; __file__='/path/to/psycopg2/setup.py'; execfile('/path/to/psycopg2/setup.py')" develop --no-deps
running develop
install_dir /path/to/acme/lib/python2.7/site-packages/
running egg_info
writing psycopg2.egg-info/PKG-INFO
writing top-level names to psycopg2.egg-info/top_level.txt
writing dependency_links to psycopg2.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'psycopg2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.js' under directory 'doc'
warning: no files found matching '*' under directory 'doc/html'
no previously-included directories found matching 'doc/src/_build'
warning: no files found matching 'PKG-INFO'
warning: no files found matching 'MANIFEST'
writing manifest file 'psycopg2.egg-info/SOURCES.txt'
running build_ext
building 'psycopg2._psycopg' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement -Wdeclaration-after-statement
/opt/python27/python/include/python2.7/datetime.h:188: warning: ‘PyDateTimeAPI’ defined but not used
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/pqpath.c -o build/temp.linux-x86_64-2.7/psycopg/pqpath.o -Wdeclaration-after-statement -Wdeclaration-after-statement
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/typecast.c -o build/temp.linux-x86_64-2.7/psycopg/typecast.o -Wdeclaration-after-statement -Wdeclaration-after-statement
psycopg/typecast.c:40: warning: ‘skip_until_space’ defined but not used
/opt/python27/python/include/python2.7/datetime.h:188: warning: ‘PyDateTimeAPI’ defined but not used
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/microprotocols.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o -Wdeclaration-after-statement -Wdeclaration-after-statement
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/microprotocols_proto.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o -Wdeclaration-after-statement -Wdeclaration-after-statement
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/connection_type.c -o build/temp.linux-x86_64-2.7/psycopg/connection_type.o -Wdeclaration-after-statement -Wdeclaration-after-statement
psycopg/connection_type.c:796: error: ‘psyco_conn_get_exception’ undeclared here (not in a function)
error: command 'gcc' failed with exit status 1
Complete output from command /path/to/acme/bin/python -c "import setuptools; __file__='/path/to/psycopg2/setup.py'; execfile('/path/to/psycopg2/setup.py')" develop --no-deps:
running develop

install_dir /path/to/acme/lib/python2.7/site-packages/

running egg_info

writing psycopg2.egg-info/PKG-INFO

writing top-level names to psycopg2.egg-info/top_level.txt

writing dependency_links to psycopg2.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

reading manifest file 'psycopg2.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

warning: no files found matching '*.html' under directory 'doc'

warning: no files found matching '*.js' under directory 'doc'

warning: no files found matching '*' under directory 'doc/html'

no previously-included directories found matching 'doc/src/_build'

warning: no files found matching 'PKG-INFO'

warning: no files found matching 'MANIFEST'

writing manifest file 'psycopg2.egg-info/SOURCES.txt'

running build_ext

building 'psycopg2._psycopg' extension

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement -Wdeclaration-after-statement

/opt/python27/python/include/python2.7/datetime.h:188: warning: ‘PyDateTimeAPI’ defined but not used

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/pqpath.c -o build/temp.linux-x86_64-2.7/psycopg/pqpath.o -Wdeclaration-after-statement -Wdeclaration-after-statement

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/typecast.c -o build/temp.linux-x86_64-2.7/psycopg/typecast.o -Wdeclaration-after-statement -Wdeclaration-after-statement

psycopg/typecast.c:40: warning: ‘skip_until_space’ defined but not used

/opt/python27/python/include/python2.7/datetime.h:188: warning: ‘PyDateTimeAPI’ defined but not used

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/microprotocols.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols.o -Wdeclaration-after-statement -Wdeclaration-after-statement

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/microprotocols_proto.c -o build/temp.linux-x86_64-2.7/psycopg/microprotocols_proto.o -Wdeclaration-after-statement -Wdeclaration-after-statement

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.3.0-beta2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x090001 -DPG_VERSION_HEX=0x090001 -I/opt/python27/python/include/python2.7 -I. -I/usr/include/postgresql-9.0 -I/usr/include/postgresql-9.0/server -c psycopg/connection_type.c -o build/temp.linux-x86_64-2.7/psycopg/connection_type.o -Wdeclaration-after-statement -Wdeclaration-after-statement

psycopg/connection_type.c:796: error: ‘psyco_conn_get_exception’ undeclared here (not in a function)

error: command 'gcc' failed with exit status 1


Command /path/to/acme/bin/python -c "import setuptools; file='/path/to/psycopg2/setup.py'; execfile('/path/to/psycopg2/setup.py')" develop --no-deps failed with error code 1
Exception information:
Traceback (most recent call last):
File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/basecommand.py", line 130, in main

self.run(options, args)

File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/commands/install.py", line 228, in run

requirement_set.install(install_options, global_options)

File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/req.py", line 1043, in install

requirement.install(install_options, global_options)

File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/req.py", line 534, in install

self.install_editable(install_options, global_options)

File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/req.py", line 617, in install_editable

show_stdout=False)

File "/path/to/acme/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg/pip/init.py", line 249, in call_subprocess

% (command_desc, proc.returncode))

InstallationError: Command /path/to/acme/bin/python -c "import setuptools; file='/path/to/psycopg2/setup.py'; execfile('/path/to/psycopg2/setup.py')" develop --no-deps failed with error code 1

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo November 17th, 2010 @ 10:47 PM

    • State changed from “new” to “invalid”

    Pip is doing something wrong: I see both -O2 and -O3 specified in the command line and -Wdeclaration-after-statement repeated twice.

    The reason for compiling failed is that pip is ignoring the "define" informations in setup.cfg, specifically it is not passing -DPSYCOPG_EXTENSIONS=1 to the compiler (nor parameters such as -DPSYCOPG_NEW_BOOLEAN=1, -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1). PSYCOPG_EXTENSIONS is supposed to only include extensions and without it you would get a no-extension dbapi driver, but it would be so useless that it has basically never been used that way.

    So I see at least three problems in the failing command line: you should take a look at pip and see why it is ignoring the setup.cfg. Some of the "define" specified there are strongly recommended.

  • Daniele Varrazzo

    Daniele Varrazzo April 3rd, 2014 @ 10:33 AM

    This problem in more recent times is affecting pip installing from url.

    Open ticket #204 to deal with it

  • Daniele Varrazzo

    Daniele Varrazzo April 4th, 2014 @ 05:11 PM

    • State changed from “invalid” to “resolved”

    Added a workaround for this that looks a setuptools bug.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Referenced by

Pages