# Multiple startup errors and no SimpleITK in May 1 nightly on mac

**URL:** <https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231>\
**Category:** Support\
**Tags:** bug\
**Created:** [May 1, 2017, 1:44pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231 "2017-05-01T13:44:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 1, 2017, 1:44pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/1 "2017-05-01T13:44:44Z")

</div>

Startup error:

```auto
code for hash md5 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
code for hash sha1 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
code for hash sha224 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
code for hash sha256 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
code for hash sha384 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
code for hash sha512 was not found.
Traceback (most recent call last):
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] =__get_hash(__func_name)
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512

```

SimpleITK import error:

```auto
>>> import SimpleITK
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/site-packages/SimpleITK/ __init__.py", line 1, in <module>
    from .SimpleITK import *
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 21, in <module>
    _SimpleITK = swig_import_helper()
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 20, in swig_import_helper
    return importlib.import_module('_SimpleITK')
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python2.7/importlib/ __init__.py", line 37, in import_module
    __import__ (name)
ImportError: No module named _SimpleITK

```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 1, 2017, 4:29pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/2 "2017-05-01T16:29:07Z")

</div>

The dashboard looks quite good.  
[http://slicer.cdash.org/index.php?project=Slicer4](http://slicer.cdash.org/index.php?project=Slicer4)

Does this error come up on other computers, too?

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 1, 2017, 5:53pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/3 "2017-05-01T17:53:08Z")

</div>

I confirm I am getting this error even after removing `~/.config`.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 1, 2017, 6:12pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/4 "2017-05-01T18:12:43Z")

</div>

Do other Mac users have this problem, too?

Have you installed Python or OpenSSL lately? (it might be related, see [https://github.com/Homebrew/legacy-homebrew/issues/22816](https://github.com/Homebrew/legacy-homebrew/issues/22816))

Does it work with earlier Slicer versions? There were Python packaging related changes and OpenSSL library install location change in the past few weeks.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 1, 2017, 6:16pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/5 "2017-05-01T18:16:50Z")

</div>

@lassoan I have not changed anything in OpenSSL (not to my knowledge, at least!). I did install python via pyenv recently.

I do not use homebrew.

If I disable the new python I installed (it is no longer in my path), I still get the same startup errors.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 1, 2017, 8:49pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/6 "2017-05-01T20:49:03Z")

</div>

@pieper and other Mac users: can you reproduce this, too?

@Fedorov Does the problem occur only with the latest version or earlier nightly or stable version, too?

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 2, 2017, 1:25am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/7 "2017-05-02T01:25:47Z")

</div>

> [@lassoan](#):
>
> Does the problem occur only with the latest version or earlier nightly or stable version, too?

Stable works fine for me. Never had this problem with nightlies before. I tried on another Mac system, different (latest) macOS version, no updates to system python, and I am getting exact same errors.

Remarkable how with all the glorious downloads we get every day not a single Mac user to test this anywhere else.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 2, 2017, 2:24am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/8 "2017-05-02T02:24:04Z")

</div>

It seems that something happened between r25945 (2017-04-25 nightly, works) and r25971 (2017-04-26 nightly, doesn’t work).

As part of this process, I also discovered a new “feature” of macOS + Slicer: apparently, it is no longer possible to allow launching apps from unidentified developers, so every time new Slicer is installed, it has to be launched twice, second time allowing to launch in the security panel. Quite annoying, considering initial launch of Slicer on mac is super slow, and macOS verifies package on each of the 2 launches…

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/176ea84ea65426409c0350396d7f14069a798417.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 2, 2017, 2:44am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/9 "2017-05-02T02:44:26Z")

</div>

@jcfr this regression may be related to your Python updates/packaging changes between 25945 and 25971. Could you please check what could be the problem?

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 2, 2017, 2:58am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/10 "2017-05-02T02:58:53Z")

</div>

> [@lassoan](#):
>
> Could you please check what could be the problem?

I see. It may be related to the following commit done between 2.7.11 and 2.7.13.

There is a big storm going on in the area and I lost the ssh connection to the macosx. I will have a look later.

> <https://github.com/python/cpython/commit/c2fc7c4f53>

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 2, 2017, 11:18am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/11 "2017-05-02T11:18:07Z")

</div>

I tested the May 1 nightly on a mac with 10.9.5 and it started with no  
problem (right click icon and pick open from menu). I can try other macs  
later.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 2, 2017, 11:48am UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/12 "2017-05-02T11:48:07Z")

</div>

I get the same failures to import hashlib on max os 10.12.4. Otherwise the  
startup process is the same as on older macs (only need to open from menu  
and pick okay) probably because I already have the security preference  
selected.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 2, 2017, 12:13pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/13 "2017-05-02T12:13:21Z")

</div>

Fails for me on older mac too.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 2, 2017, 3:37pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/14 "2017-05-02T15:37:35Z")

</div>

Discussed this with Jc today and he will try going back on python version to use the older OpenSSL for now.

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 2, 2017, 4:04pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/15 "2017-05-02T16:04:11Z")

</div>

> [@pieper](#):
>
> Otherwise the  
> startup process is the same as on older macs

@pieper no, startup process is not the same, since in the older mac you could choose “allow from anywhere” (as shown below), and in the newer macs this option is gone (as shown in a post above).

![](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/1X/56d421b63b80598e4a55647775f8ad8f49352520.jpg)

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [May 2, 2017, 4:13pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/16 "2017-05-02T16:13:36Z")

</div>

Right-click+Open (or Ctrl-click+Open) still works fine for any application. You can restore the “Anywhere” setting in Gatekeeper with a command line switch, see: [http://www.imore.com/how-open-apps-unidentified-developers-mac](http://www.imore.com/how-open-apps-unidentified-developers-mac) (not really recommended…)

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [May 2, 2017, 4:20pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/17 "2017-05-02T16:20:52Z")

</div>

> [@ihnorton](#):
>
> Right-click+Open (or Ctrl-click+Open) still works fine for any application.

I had no idea. I guess this proves that I remain a novice Mac user!

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [May 2, 2017, 5:54pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/18 "2017-05-02T17:54:29Z")

</div>

@jcfr @pieper I took a quick look at the 5/1 nightly, and the underlying issue is the failure to `import hashlib`:

> **error message**
>
> ```auto
> import _hashlib
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> ImportError: dlopen(/opt/worksw/Slicer-4.7.0-20170501.app/Contents/lib/Python/lib/python2.7/lib-dynload/_hashlib.so, 2): Library not loaded: libcrypto.dylib
> Referenced from: /opt/worksw/Slicer-4.7.0-20170501.app/Contents/lib/Python/lib/python2.7/lib-dynload/_hashlib.so
> Reason: Incompatible library version: _hashlib.so requires version 1.0.0 or later, but libcrypto.0.9.8.dylib provides version 0.9.8
> >>> 
> 
> ```

There is a [`try` block around this import](https://github.com/python/cpython/blob/2.7/Lib/hashlib.py#L133-L139), when it fails then Python falls back to looking for the generic versions of the hash functions (which aren’t compiled/available) instead of using the ones from OpenSSL.

Looking at vmmap and dyld debug trace, Slicer is loading both the Slicer version and the system version (/usr/lib/libcrypto.0.9.8.dylib) of libcrypto (and libssl). Slicer version of libcrypto/libssl is opened first, but the system version is preferred when later dlopen’ing the Python `_hashlib`. (maybe Slicer version is only opened RTLD\_LOCAL, while system version is opened RTLD\_GLOBAL. no simple way to check this)

It can be fixed locally by correcting the dependency paths, e.g. `install_name_tool -change /Users/kitware/Dashboards/Nightly/Slicer-0-build/OpenSSL/libssl.dylib /opt/worksw/Slicer-4.7.0-20170501.app/Contents/lib/Slicer-4.7/libssl.dylib /opt/worksw/Slicer-4.7.0-20170501.app/Contents/lib/Python/lib/python2.7/lib-dynload/_hashlib.so` (and likewise for libcrypto).

So possible fixes would be

- correct ®PATHs for \_hashlib on the build system
- figure out why we are loading/preferring the system libcrypto at all.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 2, 2017, 6:20pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/19 "2017-05-02T18:20:32Z")

</div>

@ihnorton Thanks for the detailed report

> [@ihnorton](#):
>
> correcting the dependency paths

The following code is/was intended to take care of this, it basically ensures the full path is associated with the libraries which then allow the fixup script to work as expected.

[https://github.com/Slicer/Slicer/blob/fba6424b7d48fb4418295105894e317de6e850bf/SuperBuild/External\_OpenSSL.cmake#L123-L131](https://github.com/Slicer/Slicer/blob/fba6424b7d48fb4418295105894e317de6e850bf/SuperBuild/External_OpenSSL.cmake#L123-L131)

I suspect the regression was introduced here:

[https://github.com/Slicer/Slicer/blob/1e9cc24cb026db42f36da9914308366a2d643405/CMake/SlicerCPackBundleFixup.cmake.in#L186-L192](https://github.com/Slicer/Slicer/blob/1e9cc24cb026db42f36da9914308366a2d643405/CMake/SlicerCPackBundleFixup.cmake.in#L186-L192)

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [May 2, 2017, 7:04pm UTC](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231/21 "2017-05-02T19:04:54Z")

</div>

I think I identified the issue.

After installing the module into `<root>/python-install/lib/python2.7.lib-dynload` the full path to the module is stripped and this prevent the fixup package from working.

It was not an issue until now because I suspect the version 0.9.8 of ssl was available on the target system.

Currently working on a fix.

[Next page](https://discourse.slicer.org/t/multiple-startup-errors-and-no-simpleitk-in-may-1-nightly-on-mac/231.md?page=2)
