Error while running fenics using docker

dear friends ,
i am getting error like this when i am trying to run python script file from other drive
''fenics@be5182b04259:~$ cd f\

cd f\phasefield\ python3 PhaseField.py
bash: cd: too many arguments’’
please suggest how to fix this

Try using a forward slash / instead of the backslash \ in the file path. In Bash, the backslash is a line continuation, so the shell thinks you are trying to pass python3 and PhasField.py as arguments to cd, instead of interpreting it as the next command.

same error is comming

fenics@be5182b04259:~$ cd f/phasefield/python3 Phasefield.py
bash: cd: too many arguments

Did you press enter after typing cd f/phasefield/?

in f drive folder name phase field

can you tell me how to import a python script file that is in my system and use it in docker

when i am trying to create the container with the command they have given i am getting this error
C:\Users\venkat>docker run -ti -p 127.0.0.1:8000:8000 -v (pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current docker: Error response from daemon: create (pwd): “$(pwd)” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9_.-]” are allowed. If you intended to pass a host directory, use absolute path.
See ‘docker run --help’

It’s been a long time since I’ve tried using Docker on Windows. Maybe try taking a look at the instructions here:

while i am trying to run demo program in fenics i am getiing the error like this demo_poisson .py
Traceback (most recent call last):
File “demo_poisson.py”, line 54, in
f = Expression(“10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)”)
File “/usr/lib/python3/dist-packages/dolfin/function/expression.py”, line 409, in init
raise KeyError(“Must supply element or degree”)
KeyError: ‘Must supply element or degree’

I guess your demo is from an older version of FEniCS, as the keyword argument degree/element has been required since v 2016.1.0.
See: the bitbucket demo for the latest version of the demo.

thanks a lot code is running
can you tell me how to convert and see the pvd files into image and video

in other code i am getting the error like this can you please tell that i think is is same older version code thats the problem could you fix it
File “Tension.py”, line 48
print “number of unknown”,mesh.num_vertices()
^
SyntaxError: invalid syntax

This looks like it’s related to the version of Python you are using (python 2 / python 3) (see for example : https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html#the-print-function)

1 Like

import matplotlib.pyplot as plt

from fenics import *
from tools.elasticity import *