Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Pip "unsupported hash type" errors after installing Python #22816

Closed
jasford opened this issue Sep 25, 2013 · 23 comments
Closed

Pip "unsupported hash type" errors after installing Python #22816

jasford opened this issue Sep 25, 2013 · 23 comments

Comments

@jasford
Copy link

jasford commented Sep 25, 2013

brew doctor

jason@localhost:~$ brew doctor
Your system is ready to brew.

brew --config

jason@localhost:~$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 4ecef35fedebb2195e2ceaba052f064e03b7442e
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.8.4-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1358221012
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

brew install -v python 2>&1

view the gist

Now, try to use pip

jason@localhost:~$ pip
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

Usage:   
  pip <command> [options]

Commands:
  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  zip                         Zip individual packages.
  unzip                       Unzip individual packages.
  bundle                      Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log <file>                Log file where a complete (maximum verbosity) record will be kept.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               Path to alternate CA bundle.
@jasford
Copy link
Author

jasford commented Sep 25, 2013

Oddly enough, after I restarted my Terminal window, pip is now working just fine. Perhaps the formula should be updated to reset whatever needs to be reset without requiring a new terminal session? Or it could give instructions to restart your Terminal session before using it? Or maybe my experience was just a fluke.

@jasford
Copy link
Author

jasford commented Sep 25, 2013

Never mind. My window was just too small to see the errors. They were scrolling up off the window where I could not see them.

So it turns out that, while pip seems to be working fine for me, it is still showing the unsupported hash type errors above.

@adamv
Copy link
Contributor

adamv commented Sep 26, 2013

I don't remember was this was the last time we saw it; something to do with openssl possibly.

@jasford
Copy link
Author

jasford commented Sep 27, 2013

I ended up uninstalling Python 2 and 3 via homebrew, using the Python 2 that comes with OSX, installing pip via easy_install, and installing Python 3 from http://www.python.org/getit/

That solved the problem for me, but doesn't really explain what happened with my homebrew install. I'm willing to close the ticket as some sort of configuration fluke, but happy to help if there is any testing I can do on my system to make homebrew better.

@jasford jasford closed this as completed Sep 27, 2013
@adamv
Copy link
Contributor

adamv commented Sep 27, 2013

If I knew what to ask for to help diagnose this I would; thanks for the offer.

We do have a similar case somewhere in the closed issues...but they're hard to search. Or at least emotionally hard to search.

@hartsold
Copy link

I'm having the same problem. I found another issue (#21329) that looks related. I followed the instructions on that issue. To wit:

1.brew (re)install openssl
2. brew (re)install python --with-brewed-openssl

But I still get the same error. This output is from near the end of the output ofbrew reinstall -vd python --with-brewed-openssl, but it's the same thing I get trying to run pip:

Building './IDLE.app'
Copying files
Done.
make[2]: [install] Error 1 (ignored)
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

@jasford
Copy link
Author

jasford commented Sep 30, 2013

@hartsold I ended up deciding it was easier to install Python using the downloadable versions from here: http://www.python.org/getit/ – and while I'd like to have used homebrew to manage Python, I wasted a lot of time trying to figure out this issue. Once I went with the direct install (I used the version that came with my Mac for Python 2, and the downloaded installer for Python 3), everything was working again and I slowly regained sanity.

@hartsold
Copy link

I went the same route. Just figured I'd add to the post so folks would know this wasn't a one-off.

@dperetti
Copy link

dperetti commented Oct 9, 2013

Have a look at /usr/lib/libssl.dylib and /usr/lib/libcrypto.dylib. They should point to libssl.0.9.8.dylib and libcrypto.0.9.8.dylib respectively. Mine were pointing to some 1.0.0 version that I had linked myself manually like two years ago in order to get some pgsl lib to work at that time.

@mihgen
Copy link

mihgen commented Mar 30, 2014

Following fixed issue for me:

brew install openssl
brew link openssl --force
brew uninstall python
brew install python --with-brewed-openssl

@dandeyagna
Copy link

This solved the issue. Thanks mihgen

@joneddy
Copy link

joneddy commented Apr 3, 2014

Same issue on Mavericks and mihgen's solution worked. Thanks.

@edglazer
Copy link

edglazer commented Apr 3, 2014

@mihgen solution worked for me on 10.9.2 as well. If its worth noting, openssl had already been installed in my case, which gave this this warning on step 1:

Warning: openssl-1.0.1f already installed

And following commands 2-4 worked and resulted in functional pip. pip pip, hooray!

@rebeling
Copy link

thanks @mihgen

@with-a-k
Copy link

The solution provided by @mihgen didn't work for me... I suppose that's probably because I used --build-from-source when installing python, but I need to do that.

EDIT: it turns out I didn't and ignoring someone else's advice was the right thing to do here.

@fredrikbonander
Copy link

@mihgen's trick didn't work on Mac OS X Yosemite 10.10 Beta 2.

@victorquinn
Copy link

@fredrikbonander I'm having the same problem with 10.10 Beta 2 and haven't found a solution yet. Will update if I do!

@dakcarto
Copy link
Contributor

@AweStriker @fredrikbonander @victorquinn

I ran into this hashlib issue yesterday (see above referenced PR). Changes have been applied to Homebrew CLT-checking code. Please do brew update and try again.

Not sure what was causing same issue, but with different CLT setup, e.g. XCode 4.6.x, as originally reported.

@toddlers
Copy link

@mihgen saved the day man !!
Thanks a lot :)

@fredrikbonander
Copy link

@dakcarto Thanks it worked!

@DomT4
Copy link
Member

DomT4 commented Jun 26, 2014

Is there not a cleaner solution than brew link openssl --force? I'd be really uncomfortable recommending that to folks. If anything ever happened to your Brew installation, your OS X would be flat left without any installed OpenSSL on the system. (And it's worth noting, the reason Homebrew tries to stay away from the --force command is because it can cause system issues).

@dakcarto
Copy link
Contributor

@DomT4 I think the above noted PR and upstream commit fixes the issue, at least where it was caused by the current CLTools not being recognized.

If the problem still persists, then it is worth noting, for debugging purposes, that the symptoms are indicative of MacOS::CLT.installed? returning false in the python formula.

@KanwalPrakashSingh
Copy link

@mihgen
saved a of time man :)
thanks

@Homebrew Homebrew locked and limited conversation to collaborators Sep 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests