# Singularity Installation from quay.io docker

**URL:** <https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425>\
**Category:** installation\
**Created:** [August 30, 2019, 2:01am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425 "2019-08-30T02:01:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavaninguva](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/pavaninguva/32/7707_2.png) [@pavaninguva](https://fenicsproject.discourse.group/u/pavaninguva)\
**Post date:** [August 30, 2019, 2:01am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/1 "2019-08-30T02:01:58Z")

</div>

Hi! So I built various singularity containers using the [https://quay.io/repository/fenicsproject/stable?tag=2016.1.0&tab=tags](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:

```auto
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](https://fenicsproject.discourse.group/t/error-in-fenics-installation-on-a-singularity-container/1261) is no longer available strangely.

Im working with the fenics\>2018.1.0.

Thanks!

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 30, 2019, 3:07am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/2 "2019-08-30T03:07:13Z")

</div>

Hi I have built several containers, most recently with `dolfin-2019.1.0` on [Singularity Hub](https://singularity-hub.org/collections/3294). You can try pulling via

```auto
 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.

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 30, 2019, 3:10am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/3 "2019-08-30T03:10:59Z")

</div>

> [@pavaninguva](#):
>
> The docker image listed in : [Error in fenics installation on a Singularity container](https://fenicsproject.discourse.group/t/error-in-fenics-installation-on-a-singularity-container/1261) is no longer available strangely.

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

---

<div class="post-metadata">

**Author:** ![pavaninguva](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/pavaninguva/32/7707_2.png) [@pavaninguva](https://fenicsproject.discourse.group/u/pavaninguva)\
**Post date:** [August 30, 2019, 4:03am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/4 "2019-08-30T04:03:20Z")

</div>

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.

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

```

Then I ran:

```auto
singularity exec fenics2019.simg python demo_cahn-hilliard.py

```

which gave the following error:

```auto
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

```auto
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!

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 30, 2019, 1:45pm UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/5 "2019-08-30T13:45:22Z")

</div>

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

```auto
singularity exec fenics19.simg python3 demo_cahn-hillard.py

```

---

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [August 30, 2019, 3:47pm UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/6 "2019-08-30T15:47:37Z")

</div>

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

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

```auto
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)...
...
...

```

---

<div class="post-metadata">

**Author:** ![pavaninguva](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/pavaninguva/32/7707_2.png) [@pavaninguva](https://fenicsproject.discourse.group/u/pavaninguva)\
**Post date:** [September 1, 2019, 3:51am UTC](https://fenicsproject.discourse.group/t/singularity-installation-from-quay-io-docker/1425/7 "2019-09-01T03:51:47Z")

</div>

Hey!

Thank you so much! It works now! It seems the issue for both your container and the [quay.io](http://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!
