Issue: Error installing under PyPy
Author: rcarmo
State: closed
Created: 2016-11-05 10:25:18

When trying to install under `pyenv`, I'm getting the following:
```
  Running setup.py install for peewee
    Complete output from command /home/rcarmo/.pyenv/versions/pypy-5.4.1/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-T8dLe0/peewee/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tOb4RG-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying peewee.py -> build/lib.linux-x86_64-2.7
    copying pwiz.py -> build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/db_url.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/csv_loader.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/test_utils.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlcipher_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/hybrid.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/reflection.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/shortcuts.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/postgres_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/djpeewee.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqliteq.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/read_slave.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/csv_utils.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/migrate.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/berkeleydb.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlite_udf.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/gfk.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/kv.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/dataset.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/flask_utils.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/apsw_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/signals.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/fields.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/__init__.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/sqlite_ext.py -> build/lib.linux-x86_64-2.7/playhouse
    copying playhouse/pool.py -> build/lib.linux-x86_64-2.7/playhouse
    running build_ext
    cythoning playhouse/_speedups.pyx to playhouse/_speedups.c
    building 'playhouse._speedups' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/playhouse
    cc -O2 -fPIC -Wimplicit -I/home/rcarmo/.pyenv/versions/pypy-5.4.1/include -c playhouse/_speedups.c -o build/temp.linux-x86_64-2.7/playhouse/_speedups.o
    playhouse/_speedups.c: In function ‘__pyx_f_7cpython_8datetime_time_tzinfo’:
    playhouse/_speedups.c:7782:46: error: ‘PyDateTime_Time {aka struct <anonymous>}’ has no member named ‘hastzinfo’
       __pyx_t_1 = (((PyDateTime_Time *)__pyx_v_o)->hastzinfo != 0);
                                                  ^
    In file included from /home/rcarmo/.pyenv/versions/pypy-5.4.1/include/Python.h:88:0,
                     from playhouse/_speedups.c:4:
    playhouse/_speedups.c:7793:61: error: ‘PyDateTime_Time {aka struct <anonymous>}’ has no member named ‘tzinfo’
         __Pyx_INCREF(((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo));
                                                                 ^
    /home/rcarmo/.pyenv/versions/pypy-5.4.1/include/object.h:50:40: note: in definition of macro ‘Py_INCREF’
     #define Py_INCREF(ob)   (((PyObject *)(ob))->ob_refcnt++)
                                            ^
    playhouse/_speedups.c:7793:5: note: in expansion of macro ‘__Pyx_INCREF’
         __Pyx_INCREF(((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo));
         ^
    playhouse/_speedups.c:7794:58: error: ‘PyDateTime_Time {aka struct <anonymous>}’ has no member named ‘tzinfo’
         __pyx_r = ((PyObject *)((PyDateTime_Time *)__pyx_v_o)->tzinfo);
                                                              ^
    playhouse/_speedups.c: In function ‘__pyx_f_7cpython_8datetime_datetime_tzinfo’:
    playhouse/_speedups.c:7856:50: error: ‘PyDateTime_DateTime {aka struct <anonymous>}’ has no member named ‘hastzinfo’
       __pyx_t_1 = (((PyDateTime_DateTime *)__pyx_v_o)->hastzinfo != 0);
                                                      ^
    In file included from /home/rcarmo/.pyenv/versions/pypy-5.4.1/include/Python.h:88:0,
                     from playhouse/_speedups.c:4:
    playhouse/_speedups.c:7867:65: error: ‘PyDateTime_DateTime {aka struct <anonymous>}’ has no member named ‘tzinfo’
         __Pyx_INCREF(((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo));
                                                                     ^
    /home/rcarmo/.pyenv/versions/pypy-5.4.1/include/object.h:50:40: note: in definition of macro ‘Py_INCREF’
     #define Py_INCREF(ob)   (((PyObject *)(ob))->ob_refcnt++)
                                            ^
    playhouse/_speedups.c:7867:5: note: in expansion of macro ‘__Pyx_INCREF’
         __Pyx_INCREF(((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo));
         ^
    playhouse/_speedups.c:7868:62: error: ‘PyDateTime_DateTime {aka struct <anonymous>}’ has no member named ‘tzinfo’
         __pyx_r = ((PyObject *)((PyDateTime_DateTime *)__pyx_v_o)->tzinfo);
                                                                  ^
    playhouse/_speedups.c: In function ‘__pyx_f_7cpython_8datetime_timedelta_days’:
    playhouse/_speedups.c:8447:44: error: ‘PyDateTime_Delta {aka struct <anonymous>}’ has no member named ‘days’
       __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->days;
                                                ^
    playhouse/_speedups.c: In function ‘__pyx_f_7cpython_8datetime_timedelta_seconds’:
    playhouse/_speedups.c:8484:44: error: ‘PyDateTime_Delta {aka struct <anonymous>}’ has no member named ‘seconds’
       __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->seconds;
                                                ^
    playhouse/_speedups.c: In function ‘__pyx_f_7cpython_8datetime_timedelta_microseconds’:
    playhouse/_speedups.c:8518:44: error: ‘PyDateTime_Delta {aka struct <anonymous>}’ has no member named ‘microseconds’
       __pyx_r = ((PyDateTime_Delta *)__pyx_v_o)->microseconds;
                                                ^
    error: command 'cc' failed with exit status 1
    
    ----------------------------------------
    Command "/home/rcarmo/.pyenv/versions/pypy-5.4.1/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-T8dLe0/peewee/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tOb4RG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-T8dLe0/peewee
```

I'm not sure what all is going on in the error you pasted. I literally have no idea.


My best guess so far is that speedups are probably missing some kind of definition to match PyPy's C headers. Cython also has issues with PyPy, so these probably need to move to cffi or something.

Either way, I need to figure out how to disable speedups when installing under PyPy...


Updated setup.py f42aa3cc76d7f3506fe714355626f4a771652c3c