title: No module named 'dolfin' using Spyder
body: <p>I can't, for the life of me, get <code>dolfin</code>running with <code>Spyder</code>. That's what I thought at first. I managed to get it running somehow, but not in a convenient way. Here is the situation:</p>
  
  <p><strong>The error</strong></p>
  
  <p><code>conda activate fenics</code>, <code>spyder</code>, <code>from dolfin import *</code>: <strong><code>No module named 'dolfin'</code></strong>.</p>
  
  <p><strong>What works</strong></p>
  
  <ul>
  <li><code>conda activate fenics</code>, <code>python</code>, <code>from dolfin import *</code>: worked in the first place.</li>
  <li><code>conda activate fenics</code>, <code>ipython</code>, <code>from dolfin import *</code>: worked after some tweaking.</li>
  <li><code>conda activate fenics</code>, <code>spyder</code>, <code>from dolfin import *</code>: worked after some tweaking.</li>
  </ul>
  
  <p><strong>What I've done so far</strong></p>
  
  <p>I installed <code>anaconda</code> using the suggested download from conda.</p>
  
  <p>Running <code>conda create -n fenics -c conda-forge fenics</code>, <code>conda install fenics</code> and <code>conda activate fenics</code> to install and activate the fenics environment.</p>
  
  <p>Then starting <code>python</code> and executing <code>from dolfin import *</code> works. <code>:)</code></p>
  
  <p>Running the same command in <code>ipython</code> doesn't work. Using <code>conda list</code> I found out that</p>
  
  <pre><code>    ...
      hdf5
      hypre
      icu
      isl
      jedi
      ...
  </code></pre>
  
  <p>there is no <code>ipython</code> in the list and <code>which</code> with <code>python</code> and <code>ipthon</code> yields</p>
  
  <pre><code>    /home/hannes/anaconda3/envs/fenics/bin/python
      /home/hannes/anaconda3/bin/python
  </code></pre>
  
  <p>Thus, <code>conda install ipython</code>, <code>ipython</code> and <code>from dolfin import *</code> works as well! <code>:)</code></p>
  
  <p>Running <code>spyder</code> and <code>from dolfin import *</code> throws the same error as with <code>ipython</code> before: <code>No module named 'dolfin'</code>. Maybe <code>spyder</code> isn't available in fenics' environment as well? <code>conda list</code> ... nope, not there. Now begins the fun part ... <code>:(</code>. <code>conda install spyder</code> and <code>which spyder</code> yields</p>
  
  <pre><code>    /home/hannes/anaconda3/envs/fenics/bin/spyder
  </code></pre>
  
  <p>However, running <code>spyder</code> throws the error </p>
  
  <pre><code>    libGL error: unable to load driver: r600_dri.so
      libGL error: driver pointer missing
      libGL error: failed to load driver: r600
      libGL error: unable to load driver: r600_dri.so
      libGL error: driver pointer missing
      libGL error: failed to load driver: r600
      libGL error: unable to load driver: swrast_dri.so
      libGL error: failed to load driver: swrast
      Segmentation fault (core dumped)
  </code></pre>
  
  <p>That seems to be some opengl issues. The solution from <a href="https://github.com/spyder-ide/spyder/issues/6968" rel="nofollow noreferrer">github issue 6968</a>, <code>conda install pyopengl</code>, didn't help <code>:(</code>; still the same <code>libGL</code> errors. Therefore, <code>conda uninstall spyder</code>, <code>spyder</code> at least gave me back spyder.</p>
  
  <p><strong>My best clue so far</strong></p>
  
  <p>I tried adding the module to PYTHONPATH by adding</p>
  
  <pre><code>    export PYTHONPATH="$PYTHONPATH:/home/hannes/anaconda3/envs/fenics/lib/python3.6/site-packages/"
  </code></pre>
  
  <p>to <code>.bashrc</code> and running a Spyder that is not inside the fenics environment. No success, although I am not sure whether I did this step correctly. Why, <code>conda activate fenics</code>, <code>spyder</code> and <code>sys.path</code> spits out:</p>
  
  <pre><code>    /home/hannes/anaconda3/lib/python3.6/site-packages/spyder
      /home/hannes/anaconda3/lib/python36.zip
      /home/hannes/anaconda3/lib/python3.6
      /home/hannes/anaconda3/lib/python3.6/lib-dynload
      /home/hannes/.local/lib/python3.6/site-packages
      /home/hannes/anaconda3/lib/python3.6/site-packages
      /home/hannes/anaconda3/lib/python3.6/site-packages/IPython/extensions
      /home/hannes/.ipython
  </code></pre>
  
  <p>Since that didn't work I got <code>from dolfin import *</code> working after running <code>conda activate fenics</code>, <code>ipython</code></p>
  
  <pre><code>    import sys
      sys.path.append('/home/hannes/anaconda3/envs/fenics/lib/python3.6/site-packages')
  </code></pre>
  
  <p>Since this is only a temporarily workaround (I have to add it every time I start Spyder) I am interested in a permanent fix.</p>
  
  <p>I'd appreciate any help :).</p>
  
  <p>Hannes</p>