Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "weak reference" error in cryptography-0.8.2 python install

Tags:

python

On our linux redhat RHEL 6 cluster, I downloaded cryptography-0.8.2.tar.gz and then ran

python setup.py install --user 

in the cryptography-0.8.2 directory. I am getting the following error. Can anyone help me solve it? I'm not up to speed on weak references, just trying to install the cryptography module. Thanks much!

rcook@rzgpu2 (cryptography-0.8.2 ): python setup.py install --user
running install
Traceback (most recent call last):
  File "setup.py", line 342, in <module>
    **keywords_with_side_effects(sys.argv)
  File "/usr/apps/python/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/apps/python/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/apps/python/lib/python2.7/distutils/dist.py", line 971, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/apps/python/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
  File "setup.py", line 119, in finalize_options
    self.distribution.ext_modules = get_ext_modules()
  File "setup.py", line 78, in get_ext_modules
    from cryptography.hazmat.bindings.commoncrypto.binding import (
  File "src/cryptography/hazmat/bindings/commoncrypto/binding.py", line 14, in <module>
    class Binding(object):
  File "src/cryptography/hazmat/bindings/commoncrypto/binding.py", line 36, in Binding
    "-framework", "Security", "-framework", "CoreFoundation"
  File "src/cryptography/hazmat/bindings/utils.py", line 97, in build_ffi_for_binding
    extra_link_args=extra_link_args,
  File "src/cryptography/hazmat/bindings/utils.py", line 106, in build_ffi
    ffi.cdef(cdef_source)
  File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/api.py", line 106, in cdef
    self._parser.parse(csource, override=override, packed=packed)
  File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 165, in parse
    self._internal_parse(csource)
  File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 199, in _internal_parse
    realtype = self._get_type(decl.type, name=decl.name)
  File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 360, in _get_type
    return self._get_struct_union_enum_type('struct', type, name)
  File "/g/g0/rcook/.local/lib/python2.7/site-packages/cffi/cparser.py", line 434, in _get_struct_union_enum_type
    return self._structnode2type[type]
  File "/usr/apps/python/lib/python2.7/weakref.py", line 256, in __getitem__
    return self.data[ref(key)]
TypeError: cannot create weak reference to 'Struct' object
like image 270
Rich Avatar asked Dec 15 '22 15:12

Rich


2 Answers

The problem is actually in the pycparser module.

As per https://bugs.launchpad.net/openstack-gate/+bug/1446882 do the following:

pip uninstall pycparser && pip install -Iv pycparser==2.10
like image 61
nmgeek Avatar answered Apr 09 '23 07:04

nmgeek


As it turns out pycparser-2.11 is the culprit for this error message/bug.

pip uninstall pycparser && pip install -Iv pycparser==2.10

like image 35
Kintaro Avatar answered Apr 09 '23 07:04

Kintaro