Failed to install hashlib, python 3, debian

44,828

hashlib module is installed by default (I think Python 2.6+). You are trying to install a backport of it created for forward compatibility of old Python versions.

Just do import hashlib and do your stuff.

You could find info about packages by searching in https://pypi.python.org/pypi.

Share:
44,828

Related videos on Youtube

dipl0
Author by

dipl0

Updated on July 17, 2020

Comments

  • dipl0
    dipl0 almost 4 years

    The software fails to install. Any help in resolving this would be appreciated.

    I believe that the error is probably a dependency error.

                 Running setup.py (path:/tmp/pip-build-9rlb94_r/hashlib/setup.py) egg_info for package hashlib
                Traceback (most recent call last):
                  File "<string>", line 3, in <module>
                  File "/usr/local/lib/python3.4/dist-packages/setuptools/__init__.py", line 10, in <module>
                    from setuptools.extern.six.moves import filter, map
                  File "/usr/local/lib/python3.4/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
                    from pkg_resources.extern import VendorImporter
                  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 36, in <module>
                    import email.parser
                  File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
                    from email.feedparser import FeedParser, BytesFeedParser
                  File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
                    from email import message
                  File "/usr/lib/python3.4/email/message.py", line 16, in <module>
                    from email import utils
                  File "/usr/lib/python3.4/email/utils.py", line 28, in <module>
                    import random
                  File "/usr/lib/python3.4/random.py", line 45, in <module>
                    from hashlib import sha512 as _sha512
                  File "/tmp/pip-build-9rlb94_r/hashlib/hashlib.py", line 80
                    raise ValueError, "unsupported hash type"
                                    ^
                SyntaxError: invalid syntax
                Complete output from command python setup.py egg_info:
                Traceback (most recent call last):
    
              File "<string>", line 3, in <module>
    
              File "/usr/local/lib/python3.4/dist-packages/setuptools/__init__.py", line 10, in <module>
    
                from setuptools.extern.six.moves import filter, map
    
              File "/usr/local/lib/python3.4/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
    
                from pkg_resources.extern import VendorImporter
    
              File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 36, in <module>
    
                import email.parser
    
              File "/usr/lib/python3.4/email/parser.py", line 12, in <module>
    
                from email.feedparser import FeedParser, BytesFeedParser
    
              File "/usr/lib/python3.4/email/feedparser.py", line 27, in <module>
    
                from email import message
    
              File "/usr/lib/python3.4/email/message.py", line 16, in <module>
    
                from email import utils
    
              File "/usr/lib/python3.4/email/utils.py", line 28, in <module>
    
                import random
    
              File "/usr/lib/python3.4/random.py", line 45, in <module>
    
                from hashlib import sha512 as _sha512
    
              File "/tmp/pip-build-9rlb94_r/hashlib/hashlib.py", line 80
    
                raise ValueError, "unsupported hash type"
    
                                ^
    
            SyntaxError: invalid syntax
    
            ----------------------------------------
    

    I am using this library to generate hashes for files and so alternative solutions would also be welcome.

    • jmd_dk
      jmd_dk almost 7 years
      The error us due to the Python 2 syntax raise ValueError, "unsupported hash type", which in Python 3 is written raise ValueError("unsupported hash type"). What command are you issuing to install hashlib?
    • dipl0
      dipl0 almost 7 years
      pip3 install hashlib :)
    • jmd_dk
      jmd_dk almost 7 years
      According to pypi, hashlib is for Python 2.4 and below. Python 2.5 and above comes with hashlib included. To see for yourself, try to import hashlib.
  • user219628
    user219628 over 4 years
    Hashlib does not show up in pip list. It does get import though, any idea?
  • Arman Ordookhani
    Arman Ordookhani over 4 years
    @user219628 It's a part of Python. You don't need to install it nor it would come up in pip list.
  • Gidi9
    Gidi9 almost 4 years
    Agreed. If you came here because of this error appearing during a Google Cloud Function deployment, just remove the dependency from the requirements.txt file
  • MacGyver
    MacGyver about 3 years
    Search for "hashlib" in the Python Standard Library. These packages do not need to be installed. They only need to be imported. docs.python.org/3/library