Singularity Installation from quay.io docker

Hi! So I built various singularity containers using the https://quay.io/repository/fenicsproject/stable?tag=2016.1.0&tab=tags docker images. It is pretty strange in that the 2016.1.0 image enables me to import dolfin just fine. But the 2018.1.0 and 2019.1.0.r3 images result in the dolfin module not loading properly:

File "demo_cahn-hilliard.py", line 110, in <module>
    from dolfin import *
ImportError: No module named dolfin

The docker image listed in : Error in fenics installation on a Singularity container is no longer available strangely.

Im working with the fenics>2018.1.0.

Thanks!

Hi I have built several containers, most recently with dolfin-2019.1.0 on Singularity Hub. You can try pulling via

 singularity pull --name <name_you_want>.simg shub://bhaveshshrimali/singularitFEniCS:recipe

In any case, the build log is a good place to look for possible bugs in the recipe file.

I had to play around with several libraries before I could finally get it to work. I will remove the old recipe file. Thanks for pointing out

Hey! Thank you for the super quick response!

I tried to clone your repo and test it using the cahn hilliard demo fron the fenics 2018.1.0 docs (it should work fine as it works fine for me on the 2019.1.0 conda env on my local). I named it fenics2019.simg fyi.

wget https://fenicsproject.org/docs/dolfin/2018.1.0/python/_downloads/demo_cahn-hilliard.py

Then I ran:

singularity exec fenics2019.simg python demo_cahn-hilliard.py

which gave the following error:

Traceback (most recent call last):
  File "demo_cahn-hilliard.py", line 110, in <module>
    from dolfin import *
ImportError: No module named dolfin

When I build the 2016.1.0 version from quay.io/fenicsproject/stable:2016.1.0 and run the same demo_cahn-hilliard.py:
The error is due to the syntax change from 2016.1.0 to >2018.1.0

Traceback (most recent call last):
  File "demo_cahn-hilliard.py", line 118, in <module>
    class InitialConditions(UserExpression):
NameError: name 'UserExpression' is not defined

Running the 2016 container with the 2016 demo code works perfectly fine!

Best!

It should have worked fine. Even as I was writing the response I shell-ed in the image and then ran python3 from the terminal which seemed to run fine. I can check the cahn-hillard-demo too in sometime.

Are you running both python2 and python3 on your system ? I use python3 inside my container just to be specific. So I would usually do

singularity exec fenics19.simg python3 demo_cahn-hillard.py

It seems to run fine for me inside the shell, I would suppose there would be no problems running it non-interactively (i.e. using singularity exec) as well. A snapshot of the trial run

python3 demo_cahn-hilliard.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Newton iteration 0: r (abs) = 1.175e+03 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-06)
Newton iteration 1: r (abs) = 1.876e-01 (tol = 1.000e-10) r (rel) = 1.596e-04 (tol = 1.000e-06)
Newton iteration 2: r (abs) = 3.360e-06 (tol = 1.000e-10) r (rel) = 2.859e-09 (tol = 1.000e-06)
Newton solver finished in 3 iterations and 3 linear solver iterations.
Newton iteration 0: r (abs) = 1.158e+01 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-06)
Newton iteration 1: r (abs) = 1.299e-01 (tol = 1.000e-10) r (rel) = 1.122e-02 (tol = 1.000e-06)
Newton iteration 2: r (abs) = 8.944e-06 (tol = 1.000e-10) r (rel) = 7.726e-07 (tol = 1.000e-06)...
...
...

Hey!

Thank you so much! It works now! It seems the issue for both your container and the quay.io repo container is the use of the command python while I should be using python3. I guess i missed the boat when fenics shifted from python2 to python3 then!

Thank you so much once again!