Installing development version: cffi.api.CDefError: parse error

63 views
Skip to first unread message

jus...@altitudelabs.com

unread,
Dec 19, 2016, 6:24:43 AM12/19/16
to gevent: coroutine-based Python network library
Hi there,

Am trying to install the development version of gevent as it contains a fix for one of the bugs with Python SSL:

pip install setuptools 'cython>=0.25' git+git://github.com/gevent/gevent.git#egg=gevent
Am getting the following error. Would appreciate if someone can point me in the right direction?

Collecting gevent from git+git://github.com/gevent/gevent.git#egg=gevent

  Cloning git://github.com/gevent/gevent.git to /private/var/folders/wv/682b9rx95mqb1k725_3hclgw0000gn/T/pip-build-Gn7sd4/gevent

    Complete output from command python setup.py egg_info:

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "/private/var/folders/wv/682b9rx95mqb1k725_3hclgw0000gn/T/pip-build-Gn7sd4/gevent/setup.py", line 182, in <module>

        run_setup(EXT_MODULES, run_make=_BUILDING)

      File "/private/var/folders/wv/682b9rx95mqb1k725_3hclgw0000gn/T/pip-build-Gn7sd4/gevent/setup.py", line 167, in run_setup

        "Development Status :: 4 - Beta"

      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup

        _setup_distribution = dist = klass(attrs)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/setuptools/dist.py", line 272, in __init__

        _Distribution.__init__(self,attrs)

      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__

        self.finalize_options()

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/setuptools/dist.py", line 327, in finalize_options

        ep.load()(self, ep.name, value)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 187, in cffi_modules

        add_cffi_module(dist, cffi_module)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module

        execfile(build_file_name, mod_vars)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/setuptools_ext.py", line 25, in execfile

        exec(code, glob, glob)

      File "src/gevent/libev/_corecffi_build.py", line 66, in <module>

        ffi.cdef(_cdef)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/api.py", line 105, in cdef

        self._cdef(csource, override=override, packed=packed)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/api.py", line 119, in _cdef

        self._parser.parse(csource, override=override, **options)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/cparser.py", line 299, in parse

        self._internal_parse(csource)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/cparser.py", line 304, in _internal_parse

        ast, macros, csource = self._parse(csource)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/cparser.py", line 262, in _parse

        self.convert_pycparser_error(e, csource)

      File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/cparser.py", line 291, in convert_pycparser_error

        raise api.CDefError(msg)

    cffi.api.CDefError: parse error

    :44:1: Illegal character '\r'

    


Jason Madden

unread,
Dec 19, 2016, 6:32:43 AM12/19/16
to gev...@googlegroups.com

> On Dec 18, 2016, at 18:28, jus...@altitudelabs.com wrote:
>
> Hi there,
>
> Am trying to install the development version of gevent as it contains a fix for one of the bugs with Python SSL:
>
> pip install setuptools 'cython>=0.25' git+git://github.com/gevent/gevent.git#egg=gevent
> Am getting the following error. Would appreciate if someone can point me in the right direction?
>
>
> File "/Users/justinyek/Sites/venture-env/lib/python2.7/site-packages/cffi/cparser.py", line 291, in convert_pycparser_error
> raise api.CDefError(msg)
> cffi.api.CDefError: parse error
> :44:1: Illegal character '\r'


I can't reproduce that error (on OS X):

$ mktmpenv -p /opt/local/bin/python2.7
Running virtualenv with interpreter /opt/local/bin/python2.7
New python executable in /Users/jmadden/Projects/VirtualEnvs/tmp-845b6943bfdd3f81/bin/python
Installing setuptools, pip, wheel...done.
This is a temporary environment. It will be deleted when you run 'deactivate'.
$ pip install -U setuptools pip cython
Requirement already up-to-date: setuptools in ./lib/python2.7/site-packages
Requirement already up-to-date: pip in ./lib/python2.7/site-packages
Collecting cython
Using cached Cython-0.25.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Installing collected packages: cython
Successfully installed cython-0.25.2
$ pip install -U cffi # This is not strictly required for CPython
Collecting cffi
Using cached cffi-1.9.1-cp27-cp27m-macosx_10_10_intel.whl
Collecting pycparser (from cffi)
Installing collected packages: pycparser, cffi
Successfully installed cffi-1.9.1 pycparser-2.17
$ pip install git+git://github.com/gevent/gevent.git#egg=gevent
Collecting gevent from git+git://github.com/gevent/gevent.git#egg=gevent
Cloning git://github.com/gevent/gevent.git to /private/var/folders/y5/x7pvzk651c3dqkllbxd1jd280000gn/T/pip-build-HACaNV/gevent
Requirement already satisfied: greenlet>=0.4.10 in ./lib/python2.7/site-packages (from gevent)
Installing collected packages: gevent
Running setup.py install for gevent ... done
Successfully installed gevent-1.2b1.dev0

Perhaps the CFFI/pyparser version installed in your environment is older?

I'm not aware of any SSL fixes that are in master that aren't released to PyPI, however, so you should just be able to `pip install 'gevent>=1.2a1'`.


Jason

jus...@altitudelabs.com

unread,
Dec 20, 2016, 8:47:32 AM12/20/16
to gevent: coroutine-based Python network library
Thanks for the reply Jason. 

pip install gevent==1.2a1 installs gevent without any issues. However, when we run our django app, it crashes on initial page load with `segmentation fault: 11`.

Jason Madden

unread,
Dec 20, 2016, 8:49:28 AM12/20/16
to gev...@googlegroups.com

> On Dec 20, 2016, at 07:46, jus...@altitudelabs.com wrote:
>
> pip install gevent==1.2a1 installs gevent without any issues. However, when we run our django app, it crashes on initial page load with `segmentation fault: 11`.
>

Did you install via a wheel, and if so, onto what machine architecture? If you install from source (`pip install --no-binary :all: gevent`) in a fresh venv does it still crash?
Reply all
Reply to author
Forward
0 new messages