OSError: [Errno 2] No such file or directory: 'cmake' after running script in Spyder

3,263 views
Skip to first unread message

Philipp Diercks

unread,
Jun 22, 2017, 9:59:12 AM6/22/17
to fenics-support
Hi All,

thanks in advance for helping me out.

I'm using FEniCS via Anaconda on MacOS (Sierra). I'm using Spyder as an Editor.

When I run the following code (example.py)
import dolfin as dlfn
# geometry
xlength
=100.0 #[mm]
ylength
=100.0 #[mm]
zlength
=100.0 #[mm]
mesh
=dlfn.BoxMesh(dlfn.Point(0.0, 0.0, 0.0),dlfn.Point(xlength, ylength, zlength), 1, 1, 1)
cells
= dlfn.CellFunction('size_t',mesh)
facets
= dlfn.FacetFunction('size_t',mesh)
dA
= dlfn.Measure('ds', domain=mesh, subdomain_data=facets)
dV
= dlfn.Measure('dx', domain=mesh, subdomain_data=cells)
# surface for bc
left
= dlfn.CompiledSubDomain('near(x[0],0) && on_boundary')
in Spyder I get an error message

OSError: [Errno 2] No such file or directory: 'cmake'
(full error message please see below).

But if I run the same code via terminal
source activate fenicsproject
python example
.py
it works fine.

I checked the Python Path Manager in Spyder and here is what I tried so far:

I added the second path, because this is where 'cmake' is supposed to be:
which cmake
yields

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


Does anybody know where the problem is? 

I would like to be able to use Spyder instead of running every script from the terminal.

Thank you,
Philipp

full error message:
Traceback (most recent call last):


 
File "<ipython-input-3-a95e08be0fa3>", line 1, in <module>
    runfile
('/Users/philippdiercks/my-fenics-projects/Damage/what.py', wdir='/Users/philippdiercks/my-fenics-projects/Damage')


 
File "/Users/philippdiercks/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 880, 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/what.py", line 20, in <module>
    left
= dlfn.CompiledSubDomain('near(x[0],0) && on_boundary')


 
File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/subdomains.py", line 148, in CompiledSubDomain
   
SubDomainClass = compile_subdomain_code(code, classname, mpi_comm=mpi_comm)


 
File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/dolfin/compilemodules/subdomains.py", line 103, in compile_subdomain_code
    compiled_module
= compile_extension_module(code, mpi_comm=mpi_comm)


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


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


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


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


 
File "/Users/philippdiercks/anaconda2/envs/fenicsproject/lib/python2.7/site-packages/instant/output.py", line 152, 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'


Johannes Ring

unread,
Jun 22, 2017, 12:40:48 PM6/22/17
to Philipp Diercks, fenics-support

Did you add /Users/philippdiercks/anaconda2/envs/fenicsproject/bin to PATH in Spyder? It looks like it is unable to find cmake when running from Spyder and that is probably a PATH issue.

Johannes

 

--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-support+unsubscribe@googlegroups.com.
To post to this group, send email to fenics-support@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fenics-support/a75f8919-03e9-42da-a6b7-e42af715b271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philipp Diercks

unread,
Jun 22, 2017, 2:29:21 PM6/22/17
to Johannes Ring, fenics-support
Hi Johannes, 

thanks for your answer. I think I did add the path to Spyder. (Can you see the Screenshot I attached to my post?)

Thanks, Philipp 

To post to this group, send email to fenics-...@googlegroups.com.

Johannes Ring

unread,
Jun 22, 2017, 2:35:25 PM6/22/17
to Philipp Diercks, fenics-support
Yes, I see the screenshot, but it does not help to add it to PYTHONPATH. You need to add it to PATH. 

Johannes 

Philipp Diercks

unread,
Jun 23, 2017, 12:03:06 PM6/23/17
to fenics-support
Hi , Johannes,

I'm new to Spyder and don't know which Path you are talking about exactly.
The Options that I know are:
    1. Change the Path in PyhtonPath Manager
    2. Change the Path for Python Interpreter (which is /Users/philippdiercks/anaconda2/bin by default)

Normally I would add the above paths to PythonPath Manager to find the modules like dolfin etc. in the Anaconda environment fenicsproject.

Can yo please be specific about the path you mean and how to change it?

Thanks, Philipp
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-suppor...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-suppor...@googlegroups.com.

To post to this group, send email to fenics-...@googlegroups.com.

Johannes Ring

unread,
Jun 23, 2017, 12:42:52 PM6/23/17
to Philipp Diercks, fenics-support
On Fri, Jun 23, 2017 at 6:03 PM, Philipp Diercks <philipp...@gmail.com> wrote:
I'm new to Spyder and don't know which Path you are talking about exactly.
The Options that I know are:
    1. Change the Path in PyhtonPath Manager
    2. Change the Path for Python Interpreter (which is /Users/philippdiercks/anaconda2/bin by default)

Normally I would add the above paths to PythonPath Manager to find the modules like dolfin etc. in the Anaconda environment fenicsproject.

Can yo please be specific about the path you mean and how to change it?

Sorry, I am not using Spyder, so I don't know how to do it in Spyder. In a terminal you would do

  export PATH=/Users/philippdiercks/anaconda2/envs/fenicsproject/bin:$PATH

This is one of the things that happens when you run `source activate fenicsproject`.

Johannes
 
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-support+unsubscribe@googlegroups.com.
To post to this group, send email to fenics-support@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fenics-support/aefee9dc-3c69-4e10-850b-53d7589d2f71%40googlegroups.com.

Philipp Diercks

unread,
Jun 25, 2017, 1:53:25 PM6/25/17
to fenics-support
Hi Johannes,

thank you very much for your help.

The problem is that I was using the "default" spyder from the Anaconda install.
I now installed spyder in the fenicsproject environment too, and it is working now.

Thanks, Philipp
Reply all
Reply to author
Forward
0 new messages