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

Running Jupyter

+1 vote

Hello, I'm novice to fenics and python , what Im trying to do is to reproduce the 1st example from the book. ft01_poisson.py.
I could successfully run it the shell , but I got Warning: Plotting backend set to 'none'. Plotting disabled.
So I decide to use Jupyter to try to plot the graphs instead. however , I cannot run Jupyter notebook , it's gives me command no found (perhaps because I installed fenics from mini conda). So I tried to install Jupyter conda install jupyter

and I got this
UnsatisfiableError: The following specifications were found to be in conflict:
- boost-cpp
- jupyter
- python 3.6*
Use "conda info " to see the dependencies for each package.

can anyone help me?

asked Apr 11, 2017 by proof23 FEniCS Novice (150 points)

Do you get the plots in shell? How did you install fenics? Seems like some parts didn't get installed correctly... or you are running the examples in an external environment tat can't see your packages.

Best!

Hi ! Thank you for your answer. I installed it by the means of conda mini 3 , with just one command. I understand that some files are missing, I cannot run many scripts, what can be a a solution in that case?
Thanks in advance

I used conda install -c condo-forge fenics

followed http://fenics.readthedocs.io/en/latest/#conda-linux-and-macos-64-bit

To be honest, I have no idea, but it does say that conda's support is experimental. In your place I would tryusing docker, or if you have ubuntu, just add the repo. I use the later and have never had issues. Hope it works. Best!

1 Answer

+1 vote

The conda package is built without VTK, but you can use matplotlib for plotting. Simply install matplotlib with conda and use something like this in your script:

from dolfin import *
parameters['plotting_backend'] == 'matplotlib'
import matplotlib.pyplot as plt
...
plot(...)
plt.show()

I am not sure what the problem is with the jupyter package. Did you try to install it from conda-forge?

conda install -c conda-forge jupyter
answered Apr 18, 2017 by johannr FEniCS Expert (17,350 points)

thank you for your answer. I have successfully installed docker already. Everything is not as easy as I thought. Now I am trying to run the example of reaction diffusion
https://fenicsproject.org/pub/tutorial/python/vol1/ft09_reaction_system.py
from notebook , but Im getting the error every time /

ImportError                               Traceback (most recent call last)
<ipython-input-2-a54993df5e96> in <module>()
     12 
     13 from __future__ import print_function
---> 14 from fenics import *
     15 
     16 T = 5.0            # final time

ImportError: No module named 'fenics'

So the problem could be in the path. But I also encountered a problem running an example with poisson.py. in the stage of 3d plotting I am getting:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-9b9278bf0f89> in <module>()
      1 from IPython.display import HTML
----> 2 HTML(X3DOM().html(u))

NameError: name 'X3DOM' is not defined

I could finally run the file from ~/shared folder.

*** Error: Unable to read data from XML file.
*** Reason: Unable to open file "navier_stokes_cylinder/cylinder.xml.gz".
*** Where: This error was encountered inside XMLFile.cpp.
*** Process: 0


*** DOLFIN version: 2016.2.0
*** Git changeset: 0f003bc07ee5fd583fb956245016d5972b80fea1

why it doesn't see the file?

Do you have the file navier_stokes_cylinder/cylinder.xml.gz in the directory where you run the script?

Yes, I could find it on the internet and saved it to the folder. I could also open notebook and run the file, but it was the same message as before

ImportError: No module named 'fenics'

apparently , notebook doesn't work properly with FenicS , or I might be doing something wrong. So the current problem is permissions, from the shell I am getting (OS X 10.11.6):

fenics@4862ad03b723:~/shared$ python pde.py 
Traceback (most recent call last):
  File "pde.py", line 10, in <module>
    mesh = Mesh('/Users/renat/pde/navier_stokes_cylinder/cylinder.xml')
  File "/usr/local/lib/python2.7/dist-packages/dolfin/mesh/meshes.py", line 63, in __init__
    cpp.Mesh.__cppinit__(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dolfin/cpp/mesh.py", line 2063, in __init__
    _mesh.Mesh_swiginit(self, _mesh.new_Mesh(*args))
RuntimeError: boost::filesystem::create_directories: Permission denied: "/Users/renat/pde"
Aborted

The path /Users/renat/pde/navier_stokes_cylinder/cylinder.xml is not accessible from within the Docker container. You can solve this by simply copying the files to the shared folder or share the /Users/renat/pde folder into the container.

...