0

I want to install the library in a local directory lib.

I ran pip install hashlib -t lib

Here is the outcome

Collecting hashlib
  Using cached https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/antkong/dev/mycompany/my-project-venv/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
        from setuptools.extern.six.moves import filter, map
      File "/Users/antkong/dev/mycompany/my-project-venv/lib/python2.7/site-packages/setuptools/extern/__init__.py", line 1, in <module>
        from pkg_resources.extern import VendorImporter
      File "/Users/antkong/dev/mycompany/my-project-venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 36, in <module>
        import email.parser
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/feedparser.py", line 27, in <module>
        from email import message
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/message.py", line 16, in <module>
        import email.charset
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/charset.py", line 13, in <module>
        import email.base64mime
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/base64mime.py", line 40, in <module>
        from email.utils import fix_eols
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/utils.py", line 27, in <module>
        import random
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in <module>
        import hashlib as _hashlib
      File "hashlib.py", line 115, in <module>
        f()
    TypeError: 'frozenset' object is not callable
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/d_/y12s1m0j49vff0hf_b1lzgdr0000gn/T/pip-install-sUTnPi/hashlib/

The most relevant answer on SO (at the time of writing this question) suggests to remove the following file

/Library/Python/2.7/site-packages/hashlib-20081119-py2.7-macosx-10.11-intel.egg

But this file does not exist on Mojave 10.14.5

What can I do to fix it?

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304

1 Answers1

0

hashlib is a standard module since Python 2.5. The module that you have installed is old and outdated, you shouldn't have installed it.

Try to uninstall it:

pip uninstall hashlib

If it doesn't uninstall remove it manually. Try to find it at /Users/antkong/dev/mycompany/my-project-venv/lib/python2.7/site-packages.

phd
  • 82,685
  • 13
  • 120
  • 165