[Tutor] cffi version mismatch stalling pip install pygit2

Mats Wichmann mats at wichmann.us
Sat May 13 13:38:53 EDT 2017


On 05/12/2017 01:44 PM, MR ZenWiz wrote:
> How do I fix this?
> 
> We are using a newer version of libgit2 than the standard release
> (libgit2.0.25.0 instead of libgit2.0.24.0 - some hard dependency in
> our code).
> 
> However, after I install libgit2 (25), I get this error chain:

If you use a virtualenv (google for instructions if you're not
familiar), you can have all the versions be what they need to be for
this install, without impacting your system versions of things - that's
about the only advice from here.  Although, I tried to install pygit2 in
a virtualenv and it failed, though a bit of a different error, so it may
be the pygit2 project itself is having some issues getting their
dependencies right.

I got this:

        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error:
command 'gcc' failed with exit status 1

without any hint of *why* gcc failed, probably it was a missing C header
file but haven't researched.

> 
> pip install pygit2
> Collecting pygit2
>   Using cached pygit2-0.25.1.tar.gz
>     Complete output from command python setup.py egg_info:
>     /usr/lib/python2.7/site-packages/setuptools/version.py:1:
> UserWarning: Module cffi was already imported from
> /usr/lib64/python2.7/site-packages/cffi/__init__.pyc, but
> /tmp/easy_install-HY89WT/cffi-1.9.1 is being added to sys.path
>       import pkg_resources
> 
>     Installed /tmp/pip-build-OX9KGK/pygit2/.eggs/cffi-1.9.1-py2.7-linux-x86_64.egg
>     /usr/lib/python2.7/site-packages/setuptools/dist.py:378:
> UserWarning: Module cffi was already imported from
> /usr/lib64/python2.7/site-packages/cffi/__init__.pyc, but
> /tmp/pip-build-OX9KGK/pygit2/.eggs/cffi-1.9.1-py2.7-linux-x86_64.egg
> is being added to sys.path
>       pkg_resources.working_set.add(dist, replace=True)
>     Traceback (most recent call last):
>       File "<string>", line 1, in <module>
>       File "/tmp/pip-build-OX9KGK/pygit2/setup.py", line 210, in <module>
>         **extra_args)
>       File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
>         _setup_distribution = dist = klass(attrs)
>       File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line
> 321, in __init__
>         _Distribution.__init__(self, attrs)
>       File "/usr/lib64/python2.7/distutils/dist.py", line 287, in __init__
>         self.finalize_options()
>       File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line
> 390, in finalize_options
>         ep.load()(self, ep.name, value)
>       File "/usr/lib64/python2.7/site-packages/cffi/setuptools_ext.py",
> line 188, in cffi_modules
>         add_cffi_module(dist, cffi_module)
>       File "/usr/lib64/python2.7/site-packages/cffi/setuptools_ext.py",
> line 49, in add_cffi_module
>         execfile(build_file_name, mod_vars)
>       File "/usr/lib64/python2.7/site-packages/cffi/setuptools_ext.py",
> line 25, in execfile
>         exec(code, glob, glob)
>       File "pygit2/_run.py", line 67, in <module>
>         ffi = FFI()
>       File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 54,
> in __init__
>         backend.__version__, backend.__file__))
>     Exception: Version mismatch: this is the 'cffi' package version
> 1.10.0, located in '/usr/lib64/python2.7/site-packages/cffi/api.pyc'.
> When we import the top-level '_cffi_backend' extension module, we get
> version 1.9.1, located in
> '/tmp/pip-build-OX9KGK/pygit2/.eggs/cffi-1.9.1-py2.7-linux-x86_64.egg/_cffi_backend.so'.
> The two versions should be equal; check your installation.
> 
>     ----------------------------------------
> Command "python setup.py egg_info" failed with error code 1 in
> /tmp/pip-build-OX9KGK/pygit2/
> 
> Thanks.
> MR (long time s/w professional but python newb)
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list