8

I needed a simple hash function for passwords and thought I could use hashlib. PyCharm suggested to install it by running pip install hashLib.

But now PyCharm is complaining about a syntax error in the library:

Collecting hashLib
Using cached https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/setup.py", line 68
    print "unknown OS, please update setup.py"
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("unknown OS, please update setup.py")?

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6_/8g1vyy5n1t1859x2d30ssk480000gn/T/pycharm-packaging/hashLib/

It suggests that it may be a problem related to the Python version I am using (I tried with Python 2.7 and Python 3.8, but none of them worked).

Make sure that you use a version of Python supported by this package. Currently you are using Python 3.8.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
meme
  • 81
  • 1
  • 1
  • 3

1 Answers1

19

hashlib is in the standard library now. That means you don't need to install it, it's there already with your Python installation.

The one you tried to install from PyPI is for very old versions of Python (<= 2.4).

wim
  • 338,267
  • 99
  • 616
  • 750
  • but when I am trying to import it I got the error and it suggests me: "pip install hashLib" . So I do it in the terminal, and still it doesn't work. It complains about the parenthesis misspelling. – meme Nov 26 '19 at 06:07
  • I think this is just PyCharm being dumb. Change the import to `hashlib` not `hashLib`. – wim Nov 26 '19 at 06:10
  • Okay, now I got another type of error: "TypeError: 'frozenset' object is not callable" – meme Nov 26 '19 at 06:13
  • Looks like hashLib problem is solved isn't it? As for frozenset problem, that would be a **[different question](https://meta.stackexchange.com/questions/43478/exit-strategies-for-chameleon-questions "at Stack Exchange sites, “chameleon questions” are not quite welcome")**, consider posting it separately. – wim Nov 26 '19 at 06:19
  • no, no... actually I am getting the same error. I got the frozenset problem once I tried to download hashlib from the terminal. But now I am getting the misspelling error all the time – meme Nov 26 '19 at 06:58