Pip Fails With Attributeerror: 'module' Object Has No Attribute '_init_cffi_1_0_external_module'
Solution 1:
After looking at this some more, I discovered that the Fedora bug report above had information that really helped:
at some point, cffi 1.1.2 from pip is being overwritten with cffi 0.8.6 from the python-cffi package. As cryptography 1.1.2 is making a call to the cffi_1_0_external_module' it doesn't exists and thus fails.
I dug around, and found that I had an obsolete cffi
version in ~/.local/lib/python2.7/site-packages/
(presumably from a pip install --user ...
some years ago).
A general way to explore that and check versions is:
>>> import cffi
>>> cffi.__version__
'0.8.6'>>> cffi
<module 'cffi'from'$HOME/.local/lib/python2.7/site-packages/cffi/__init__.pyc'>
Removing that directory fixed pip, but presumably could have interefered with something else I installed long ago.
I also hear that it can help in some related situations to use easy_install (since pip isn't working...) to upgrade cffi:
easy_install -U cffi
I'm still curious if there is a large lesson here about how to avoid this sort of thing in the future.
- Why is cffi both within pip and an external package?
- Are local installs dangerous, since they persist past OS and Python upgrades?
- Are there general packaging/dependency best practices that would avoid these sorts of package dependency problems?
Post a Comment for "Pip Fails With Attributeerror: 'module' Object Has No Attribute '_init_cffi_1_0_external_module'"