After installation of vtk with brew (macosx): "import vtk" aborts python console
<p>I tried to install vtk with homebrew but, now when I <code>import vtk</code> on Python, my python session is aborted...</p>

<p>I work on MacOSX and I ran this line:</p>

<pre><code>brew install vtk --with-qt --with-python --with-pyqt
</code></pre>

<p>It returns:</p>

<pre class="lang-none prettyprint-override"><code>....
[ 29%] Built target vtkFiltersCore
    make: *** [all] Error 2

    READ THIS: https://git.io/brew-troubleshooting
    If reporting this issue please do so at (not Homebrew/brew):
      https://github.com/Homebrew/homebrew-science/issues
....
</code></pre>

<p>After that I read that I should use this line:</p>

<pre><code>HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install vtk --qt --python --pyqt
</code></pre>

<p>After a long time, it returns:</p>

<pre class="lang-none prettyprint-override"><code>....
 ==&gt; Caveats
    Even without the --with-qt option, you can display native VTK render windows
    from python. Alternatively, you can integrate the RenderWindowInteractor
    in PyQt, PySide, Tk or Wx at runtime. Read more:
        import vtk.qt4; help(vtk.qt4) or import vtk.wx; help(vtk.wx)

    Python modules have been installed and Homebrew's site-packages is not
    in your Python sys.path, so you will not be able to import the modules
    this formula installed. If you plan to develop with these modules,
    please run:
      mkdir -p /Users/TheUser/Library/Python/2.7/lib/python/site-packages
      echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' &gt;&gt; /Users/TheUser/Library/Python/2.7/lib/python/site-packages/homebrew.pth
    ==&gt; Summary
    í ¼í½º  /usr/local/Cellar/vtk/7.0.0_3: 3,203 files, 107.7M
</code></pre>

<p>So I ran the mkdir &amp; echo lines</p>

<p>And when I tried <code>import vtk</code> in the Python console, it returns:</p>

<pre class="lang-none prettyprint-override"><code>    Fatal Python error: PyThreadState_Get: no current thread
    Abort trap: 6
</code></pre>

<p>I retried to reinstall it later:</p>

<pre class="lang-none prettyprint-override"><code>==&gt; Installing vtk from homebrew/science
Error: vtk-7.0.0_3 already installed
To install this version, first `brew unlink vtk`
</code></pre>

<p>So I did the unlink, and I reran <code>HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install vtk --qt --python --pyqt</code> .</p>

<p>The result:</p>

<pre class="lang-none prettyprint-override"><code>==&gt; Patching VTK to use system Python 2
==&gt; Caveats
Even without the --with-qt option, you can display native VTK render windows from python. Alternatively, you can integrate the RenderWindowInteractor in PyQt, PySide, Tk or Wx at runtime. Read more:
    import vtk.qt4; help(vtk.qt4) or import vtk.wx; help(vtk.wx)

VTK was linked against your system copy of Python.
If you later decide to change Python installations, relink VTK with:

  brew postinstall vtk
==&gt; Summary
í ¼í½º  /usr/local/Cellar/vtk/7.0.0_5: 3,204 files, 107.7M
</code></pre>

<p>And when I <code>import vtk</code> on the python console: abortion!</p>

<p>How can I fix that?</p>

<p>I am currently updating to vtk/7.0.0_5 (used 7.0.0_3 before), the line I used to install it was :</p>

<pre><code>brew install vtk --with-qt --with-qt5 --with-python 
</code></pre>

<p>And I did not get any issue using it in python (2.7).</p>

<p>Ok - So just finished to do the upgrade to 7.0.0_5 and I got the same message tan you. But no issue at all to launch python and launch :</p>

<pre><code>&gt; $ python                                                                     
Python 2.7.12 (default, Oct 11 2016, 05:20:59) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin 
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import vtk
&gt;&gt;&gt; import vtk.qt4
</code></pre>

<p>Hope that help,</p>

<p>Stephane</p>

python osx homebrew vtk failed-installation