2

I have this error on each my command with Python:

➜  /tmp sudo easy_install pip
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.7", line 11, in 
    load_entry_point('setuptools==1.1.6', 'console_scripts', 'easy_install')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/__init__.py", line 11, in 
    from setuptools.extension import Extension
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/extension.py", line 5, in 
    from setuptools.dist import _get_unpatched
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line 15, in 
    from setuptools.compat import numeric_types, basestring
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/compat.py", line 17, in 
    import httplib
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 80, in 
    import mimetools
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in 
    import tempfile
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in 
    from random import Random as _Random
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in 
    import hashlib as _hashlib
  File "build/bdist.macosx-10.11-intel/egg/hashlib.py", line 115, in 
    """
TypeError: 'frozenset' object is not callable

What can I do with this?

user3689574
  • 1,596
  • 1
  • 11
  • 20
andre487
  • 1,261
  • 2
  • 18
  • 27
  • What can you do? Avoid calling it `like_this(foo)` – Luis Masuelli Aug 03 '16 at 19:12
  • 2
    Looks like you have a broken `hashlib.pyc` file somewhere. Can you show us the output of `python -v -m random`? `build/bdist.macosx-10.11-intel/egg/hashlib.py` doesn't look like a standard library path, nor does the source code line shown make any sense. – Martijn Pieters Aug 03 '16 at 19:15
  • you can refer this one http://stackoverflow.com/questions/34083381/frozenset-object-is-not-callable – Ganesh_ Aug 03 '16 at 19:31
  • @ganeshgadila: this is not in their own code, at least not yet proven so. – Martijn Pieters Aug 03 '16 at 21:05
  • @MartijnPieters I have that output on `python -v -m random`: http://pastebin.com/f3YUf6ck – andre487 Aug 04 '16 at 12:03
  • @MartijnPieters Yes, it's strange. But I have found broken haslib package, I posted answer below. – andre487 Aug 04 '16 at 12:32
  • @Andre-487: yes, I see it listed in the `-v` output anyway; not 100% certain why the egg was skipped and the stdlib version was loaded there, but you found the culprit. – Martijn Pieters Aug 04 '16 at 12:34

2 Answers2

12

I had this problem too, but I also needed the hashlib package to be installed (On Debian).

The best solution that I found (Better then to install hashlib with easy_install) was from here: https://askubuntu.com/questions/770262/python-hashlib-fails-to-install-pip

And it is:

"The quick and dirty fix is to remove the /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so file"

After this it is possible to install hashlib with pip!

user3689574
  • 1,596
  • 1
  • 11
  • 20
4

Removal of this package have helped me:

sudo rm -rf /Library/Python/2.7/site-packages/hashlib-20081119-py2.7-macosx-10.11-intel.egg
andre487
  • 1,261
  • 2
  • 18
  • 27