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

No such file or directory: 'cmake' after Expression

0 votes

Hi All,

thanks in advance for helping me out.

I'm having trouble with the following Expression:

import dolfin as dlfn
...
u2 = dlfn.Expression(('(A*time+B)*length','0.0','0.0'), A=-0.08, B=0.05, time=0.0, length=xlength, degree=1)

Normally an Expression of the form

tr = dlfn.Expression(('A','0.0','0.0'), A=10.0, degree=1)

works well. What is wrong with the first one? It should be possible to have more than one parameter. Also the Expression

f = Expression('A*sin(x[0]) + B*cos(x[1])', A=2.0, B=Constant(4.0))

from the documentation https://fenicsproject.org/olddocs/dolfin/2016.2.0/python/programmers-reference/functions/expression/Expression.html does not work.
What am I missing here?

Thanks, Philipp

See the whole error message below:
--- Instant: compiling ---
Traceback (most recent call last):

File "", line 1, in
runfile('/Users/philippdiercks/my-fenics-projects/Damage/ratenform.py', wdir='/Users/philippdiercks/my-fenics-projects/Damage')

File "/Users/philippdiercks/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
execfile(filename, namespace)

File "/Users/philippdiercks/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)

File "/Users/philippdiercks/my-fenics-projects/Damage/ratenform.py", line 111, in
u2 = dlfn.Expression(('(Atime+B)length','0.0','0.0'), A=-0.08, B=0.05, time=0.0, length=xlength, degree=1)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/functions/expression.py", line 654, in new
mpi_comm=kwargs.get("mpi_comm"))

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 214, in compile_expressions
mpi_comm=mpi_comm)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 141, in compile_expression_code
mpi_comm=mpi_comm)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 68, in mpi_jit
return local_jit(*args, **kwargs)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/compilemodule.py", line 472, in compile_extension_module
**instant_kwargs)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/instant/build.py", line 578, in build_module
build_system)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/instant/build.py", line 150, in recompile
ret, output = get_status_output(cmd)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/instant/output.py", line 150, in get_status_output
stderr=subprocess.STDOUT)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/subprocess32.py", line 825, in init
restore_signals, start_new_session)

File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/subprocess32.py", line 1574, in _execute_child
raise child_exception_type(errno_num, err_msg)

OSError: [Errno 2] No such file or directory: 'cmake'

closed with the note: problem solved, see comments
asked Jun 17, 2017 by philippdiercks FEniCS Novice (230 points)
closed Jun 25, 2017 by philippdiercks

1 Answer

0 votes

Instant is using cmake at runtime, so you need to install it and make sure it is available in PATH.

answered Jun 19, 2017 by johannr FEniCS Expert (17,350 points)

Hi,

thank you for your answer. Unfortunately I don't understand what seems to be the problem here. I have installed FEniCS via Anaconda on MacOS. Using conda list in the active fenicsproject-environment I get

cmake                     3.8.0                         0    conda-forge

So it should be available. Also what I do not understand is: Why should

tr = dlfn.Expression(('A','0.0','0.0'), A=10.0, degree=1)

work and the other line not, if there is something wrong with the PATH.
Also which PATH do you mean exactly and how can I access it?
(sorry for my lack of knowledge, I'm still new to this)

Thanks, Philipp

What do you get when you run the following commands?

which cmake
cmake --version

by the command

which cmake

I get the path to cmake

/Users/philippdiercks/anaconda2/envs/fenicsproject/bin/cmake

by running

cmake --version

I get

cmake version 3.8.0

Looks fine. I don't know what the problem is. You can try to report it to the FEniCS support mailing list: fenics-support@googlegroups.com.

The actual problem was that I used the "default" spyder which is installed automatically when installing Anaconda. Somehow the PATH can't be set correctly.

I had to install spyder in the Anaconda environment "fenicsproject".
Now all packages and modules are known by spyder.

Good.

Btw, it would have been nice if you had mentioned in your question that you where trying to use this in Spyder. That would have made it easier to give a proper answer.

...