This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to use FEniCS in Jupyter by Anaconda

0 votes

I have installed FEniCS through anaconda and activate it by

source activate fenicsproject

Now the python has referred to

(fenicsproject) Nailo[Dolfin]$which python
//anaconda/envs/fenicsproject/bin/python

The FEniCS works in the terminal. However, when I open a jupyter notebook and try to import dolfin like

from dolfin import *

The error shows

ImportError: No module named 'dolfin'

How can I use FEniCS in jupyter?

Any hint or help is much appreciated.

asked Apr 24, 2017 by silentdragon FEniCS Novice (160 points)

1 Answer

+1 vote
 
Best answer

This works fine for me. Here is what I did:

  • Installed FEniCS and Jupyter from conda-forge channel:

    conda create -n fenicsproject -c conda-forge python=3.5 jupyter fenics

  • Activated fenicsproject:

    source activate fenicsproject

  • Started a Jupyter notebook:

    jupyter-notebook --ip=0.0.0.0

This opened up a notebook in my web browser and I clicked on New -> Python 3 and from there I could import dolfin.

answered Apr 25, 2017 by johannr FEniCS Expert (17,350 points)
selected Apr 25, 2017 by silentdragon

Thank you very much for your help.

...