chtd / psycopg2cffi

Port to cffi with some speed improvements
Other
177 stars 43 forks source link

Installing psycopg2cffi under pypy is failing with PyBaseExceptionObject #53

Closed jdoranster closed 8 years ago

jdoranster commented 8 years ago

I'm running tox on a debian 7.9 64 bit env with pypy from pypy-2.6.1-linux_x86_64-portable. Running tox -e pypy I'm getting a consistent failure while setting up psycopg2cffi with the following

 Running setup.py install for psycopg2
    building 'psycopg2._psycopg' extension
    cc -O2 -fPIC -Wimplicit -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090309 -DHAVE_LO64=1 -I/home/jeff/lexmachina/deus_lex/.tox/pypy/include -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    In file included from psycopg/psycopgmodule.c:38:0:
    ./psycopg/error.h:32:5: error: unknown type name ‘PyBaseExceptionObject’
    error: command 'cc' failed with exit status 1
    Complete output from command /home/jeff/lexmachina/deus_lex/.tox/pypy/bin/pypy -c "import setuptools, tokenize;__file__='/home/jeff/lexmachina/deus_lex/.tox/pypy/build/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FGf5ix-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jeff/lexmachina/deus_lex/.tox/pypy/include/site/python2.7:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/psycopg2

copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2

copying lib/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2

creating build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_notify.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/__init__.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests

running build_ext

building 'psycopg2._psycopg' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/psycopg

cc -O2 -fPIC -Wimplicit -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090309 -DHAVE_LO64=1 -I/home/jeff/lexmachina/deus_lex/.tox/pypy/include -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.3/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

In file included from psycopg/psycopgmodule.c:38:0:

./psycopg/error.h:32:5: error: unknown type name ‘PyBaseExceptionObject’

error: command 'cc' failed with exit status 1
lopuhin commented 8 years ago

This looks like it is installing psycopg2, not psycopg2cffi. What are the commands you are running?

jdoranster commented 8 years ago

Yes that was my assumption, but my tox.ini is setup to use a specific requirements file which only references psycopg2cffi. I think I've scrubbed any psycopy2 references.

running tox -e pypy

tox.ini:

# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py27, py34,  pypy
skipsdist = True

[testenv]
deps = nose
commands = nosetests -v --noexe  {posargs}
passenv=HOME

[testenv:py27]
deps = -rtox-requirements.txt

[testenv:py34]
deps = -rtox-requirements34.txt

[testenv:pypy]
deps = -rtox-requirementsPyPy.txt

tox-requirementsPyPy.txt:

-r requirementsPyPy.txt
-r requirements-local.txt

requirements-local.txt is for various other applications and none of them have psycopyg2 requirementsPyPy.txt:

alembic==0.7.4
amqp==1.4.6
amqplib==1.0.2
anyjson==0.3.3
apache-libcloud==0.17.0
appenlight-client==0.6.14
argh==0.26.1
astroid==1.2.1
avro==1.7.6
Babel==1.3
backports.ssl-match-hostname==3.4.0.2
bcrypt==1.1.1
Beaker==1.6.4
beautifulsoup4==4.3.2
betamax==0.4.2
billiard==3.3.0.19
blinker==1.3
boto==2.38.0
BTrees==4.0.8
bunch==1.0.1
celery==3.1.17
cffi==1.1.2
Chameleon==2.18
CherryPy==3.6.0
colander==1.0
configobj==5.0.6
coverage==3.7.1
crcmod==1.7
cryptography==0.9.1
cssselect==0.9.1
cssutils==1.0
decorator==3.4.2
deform==0.9.9
deform-bootstrap==0.2.9
dogpile.cache==0.5.6
dogpile.core==0.4.1
elasticsearch==1.5.0
extras==0.0.3
first==2.0.1
Flask==0.10.1
Flask-Login==0.2.11
Flask-Mail==0.9.0
Flask-WTF==0.10.0
FormEncode==1.3
fuzzywuzzy==0.4.0
gcs-oauth2-boto-plugin==1.9
google-api-python-client==1.4.0
gsutil==4.13
html2text==2015.6.6
html5lib==0.99999
httplib2==0.9.1
humanize==0.5.1
ipython==2.3.1
iso8601==0.1.10
itsdangerous==0.24
jdcal==1.0
Jinja2==2.7.3
kombu==3.0.24
LEPL==5.1.3
lettuce==0.2.20
lettuce-webdriver==0.3.5
linecache2==1.0.0
logilab-common==0.63.0
logstash-formatter==0.5.9
lxml==3.4.4
mailsnake==1.3.5
Mako==1.0.1
Markdown==2.6.2
MarkupSafe==0.23
marrow.interface==1.0.1
marrow.mailer==4.0.0
marrow.util==1.2.3
mechanize==0.2.5
medusa==0.5.4
meld3==1.0.0
mistune==0.5
mock==1.0.1
mock-http==1.0
nose==1.3.7
oauth==1.0.1
oauth2client==1.4.11
openpyxl==2.1.3
Paste==1.7.5.1
PasteDeploy==1.5.2
PasteScript==2.0.2
pbr==0.10.0
peppercorn==0.4
perfmetrics==2.0
persistent==4.0.8
planterbox==0.4.1
planterbox-webdriver==0.3.1
#poster==0.8.1
premailer==2.7.0
psutil==2.1.3
psycopg2cffi==2.7.2
pyasn1==0.1.7
pyasn1-modules==0.0.5
pycparser==2.14
pycrypto==2.6.1
pyelasticsearch==1.4.0
pyes==0.99.5
Pygments==2.0.2
PyLD==0.5.4
pylint==1.3.1
Pylons==1.0.1
pymongo==2.7.2
pyOpenSSL==0.15.1
pyPdf==1.13
Pyphen==0.9.1
pyramid==1.5.7
pyramid-beaker==0.8
pyramid-chameleon==0.3
pyramid-debugtoolbar==2.4
pyramid-exclog==0.7
pyramid-mailer==0.13
pyramid-mako==1.0.2
pyramid-marrowmailer==0.1
pyramid-redis-sessions==1.0a1
pyramid-tablib==0.1
pyramid-tm==0.12
pystache==0.5.4
python-dateutil==2.4.2
python-docraptor==1.2.1
python-gflags==2.0
python-memcached==1.57
python-mimeparse==0.1.4
python-snappy==0.5
python-subunit==1.1.0
pytz==2015.4
PyYAML==3.11
raven==5.1.1
redis==2.10.3
repoze.catalog==0.8.2
repoze.depinj==0.3
repoze.lru==0.6
repoze.pgtextindex==1.2
repoze.sendmail==4.2
requests==2.4.3
retools==0.4.1
retry-decorator==1.0.0
Routes==2.0
rsa==3.1.4
selenium==2.44.0
setproctitle==1.1.8
simplejson==3.6.5
six==1.9.0
SocksiPy-branch==1.1
SQLAlchemy==0.9.8
sqlalchemy-migrate==0.9.2
sqlparse==0.1.15
statsd==3.0.1
sure==1.2.7
tablib==0.10.0
Tempita==0.5.2
testing.postgresql==1.2.0
testtools==1.7.1
thrift==0.9.2
titlecase==0.7.1
ToscaWidgets==0.9.12
traceback2==1.4.0
transaction==1.4.4
translationstring==1.3
tw.forms==0.9.9
unicodecsv==0.9.4
unittest2==0.5.1
uritemplate==0.6
urllib3==1.9.1
venusian==1.0
waitress==0.8.9
WebError==0.10.3
WebHelpers==1.3
WebOb==1.4.1
WebTest==2.0.16
Werkzeug==0.9.6
WTForms==2.0.2
XMLLayout==1.0
zc.lockfile==1.1.0
ZConfig==3.0.4
zdaemon==4.0.0
ZEO==4.1.0
ZODB3==3.11.0
ZODB==4.1.0
zope.component==4.2.1
zope.contenttype==4.0.1
zope.deprecation==4.1.2
zope.event==4.0.3
zope.index==4.0.1
zope.interface==4.1.2
zope.sqlalchemy==0.7.6
jdoranster commented 8 years ago

Actually I think it's a secondary psycopg2 requirement from a third party after capturing all the build output and scanning it more closely

Downloading/unpacking psycopg2 (from repoze.pgtextindex==1.2->-r requirementsPyPy.txt (line 137))

So mark as 'Done'
Thanks

lopuhin commented 8 years ago

Great that you figured it out! There is a https://pypi.python.org/pypi/psycopg2cffi-compat/ package that maps psycopg2 to psycopg2cffi - if you install it before another package that requires psycopg2, I think it will not try to install vanilla psycopg2.