scikit-fmm not installed correctly

1,203 views
Skip to first unread message

Binod Thapa-Chhetry

unread,
Dec 28, 2012, 4:44:15 PM12/28/12
to sciki...@googlegroups.com
Hi all,

Looks like I am missing cfmm module that scikit-fmm needs(please check the error message below). I would appreciate if you could tell me how do I resolve this issue.

Thanks in advance,
Binod

[binod@malbec ~/Downloads/scikit-fmm-master]$ python -c "import skfmm; skfmm.test()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "skfmm/__init__.py", line 92, in <module>
    from pfmm import distance, travel_time, extension_velocities
  File "skfmm/pfmm.py", line 2, in <module>
    from cfmm import cFastMarcher
ImportError: No module named cfmm

Jason Furtney

unread,
Dec 28, 2012, 8:12:25 PM12/28/12
to sciki...@googlegroups.com
Binod,

I think there is a problem with importing skfmm when python is started
in the scikit-fmm source directory. Try
cd ..
python -c "import skfmm; skfmm.test()"

cfmm is the compiled c/c++ part of scikit-fmm; as far as I know it
builds and installs OK.

Also, checkout pylsmlib: https://github.com/ktchu/LSMLIB/tree/master/pylsmlib

Thanks,
Jason
> --
> You received this message because you are subscribed to the Google Groups
> "scikit-fmm" group.
> To post to this group, send email to sciki...@googlegroups.com.
> To unsubscribe from this group, send email to
> scikit-fmm+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/scikit-fmm/-/AMK3CMAbeNMJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
--
Jason K. Furtney
Itasca Consulting Group
111 3rd Ave. South, Suite 450
Minneapolis, MN 55401 USA
(612) 371-4711

Binod Thapa-Chhetry

unread,
Dec 28, 2012, 8:52:32 PM12/28/12
to sciki...@googlegroups.com
Hi Jason,

Thanks for the reply. I tried what you had suggested, and it still can't find the cfmm module(gives the same error that I had posted earlier).
Once I downloaded the source code, I cded into the folder and did python setup.py install. Am I missing any installation step? I tried mac os and linux, and both gave me same error. One more thing, inside the source code folder under skfmm directory I see fmm.cpp, heap.cpp, etc but no cfmm.cpp or cfmm.h.
Actually, I am hoping to use scikit-fmm(given that I install it correctly!) in the dti tensor data to to get the velocity and arrival time map for specific seed regions.

Thanks,
Binod

Jason Furtney

unread,
Dec 29, 2012, 9:51:16 AM12/29/12
to sciki...@googlegroups.com
Binod,

Thanks for the additional details. It sounds like the c extension
module is not building. If you are on a Debian based system make sure
you have the python-dev package installed. Can you check out a clean
copy and send the output of the "python setup.py build" command?

The cfmm module is created from the c and c++ source files in the
skfmm directory. See skfmm/setup.py

If you are on windows there is a pre-compiled binary on pypi:
http://pypi.python.org/pypi/scikit-fmm

Thanks for the report, I am sure we can get you up and running.
Jason

On Fri, Dec 28, 2012 at 7:52 PM, Binod Thapa-Chhetry
> https://groups.google.com/d/msg/scikit-fmm/-/B8_uzuSYspAJ.

Binod Thapa-Chhetry

unread,
Dec 29, 2012, 11:19:29 AM12/29/12
to sciki...@googlegroups.com
Hi Jason,

I don't have access to debian or windows. I am limited to osx and ubuntu,but the package should be os independent, right?

In the osx I tried python setup.py build, and here is the output of it:


[scikit-fmm-master]$ python setup.py build
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "skfmm.cfmm" sources
build_src: building npy-pkg config files
running build_py
creating build
creating build/lib.macosx-10.6-x86_64-2.6
creating build/lib.macosx-10.6-x86_64-2.6/skfmm
copying skfmm/__init__.py -> build/lib.macosx-10.6-x86_64-2.6/skfmm
copying skfmm/pfmm.py -> build/lib.macosx-10.6-x86_64-2.6/skfmm
copying skfmm/setup.py -> build/lib.macosx-10.6-x86_64-2.6/skfmm
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'skfmm.cfmm' extension
compiling C++ sources
C compiler: /usr/bin/g++-4.2 -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall

creating build/temp.macosx-10.6-x86_64-2.6
creating build/temp.macosx-10.6-x86_64-2.6/skfmm
compile options: '-Iskfmm -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'
g++-4.2: skfmm/distance_marcher.cpp
g++-4.2: skfmm/travel_time_marcher.cpp
g++-4.2: skfmm/heap.cpp
g++-4.2: skfmm/extension_velocity_marcher.cpp
g++-4.2: skfmm/base_marcher.cpp
g++-4.2: skfmm/fmm.cpp
/usr/bin/g++-4.2 -L/opt/local/lib -bundle -undefined dynamic_lookup build/temp.macosx-10.6-x86_64-2.6/skfmm/fmm.o build/temp.macosx-10.6-x86_64-2.6/skfmm/heap.o build/temp.macosx-10.6-x86_64-2.6/skfmm/base_marcher.o build/temp.macosx-10.6-x86_64-2.6/skfmm/distance_marcher.o build/temp.macosx-10.6-x86_64-2.6/skfmm/travel_time_marcher.o build/temp.macosx-10.6-x86_64-2.6/skfmm/extension_velocity_marcher.o -o build/lib.macosx-10.6-x86_64-2.6/skfmm/cfmm.so
running scons

Then, python setup.py install gave me this:

[scikit-fmm-master]$ sudo python setup.py install
Password:
running install
running bdist_egg
running egg_info
running build_src
build_src
building extension "skfmm.cfmm" sources
build_src: building npy-pkg config files
creating scikit_fmm.egg-info
writing requirements to scikit_fmm.egg-info/requires.txt
writing scikit_fmm.egg-info/PKG-INFO
writing top-level names to scikit_fmm.egg-info/top_level.txt
writing dependency_links to scikit_fmm.egg-info/dependency_links.txt
writing manifest file 'scikit_fmm.egg-info/SOURCES.txt'
reading manifest file 'scikit_fmm.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'scikit_fmm.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
running scons
creating build/bdist.macosx-10.6-x86_64
creating build/bdist.macosx-10.6-x86_64/egg
creating build/bdist.macosx-10.6-x86_64/egg/skfmm
copying build/lib.macosx-10.6-x86_64-2.6/skfmm/__init__.py -> build/bdist.macosx-10.6-x86_64/egg/skfmm
copying build/lib.macosx-10.6-x86_64-2.6/skfmm/cfmm.so -> build/bdist.macosx-10.6-x86_64/egg/skfmm
copying build/lib.macosx-10.6-x86_64-2.6/skfmm/pfmm.py -> build/bdist.macosx-10.6-x86_64/egg/skfmm
copying build/lib.macosx-10.6-x86_64-2.6/skfmm/setup.py -> build/bdist.macosx-10.6-x86_64/egg/skfmm
byte-compiling build/bdist.macosx-10.6-x86_64/egg/skfmm/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/skfmm/pfmm.py to pfmm.pyc
byte-compiling build/bdist.macosx-10.6-x86_64/egg/skfmm/setup.py to setup.pyc
creating stub loader for skfmm/cfmm.so
byte-compiling build/bdist.macosx-10.6-x86_64/egg/skfmm/cfmm.py to cfmm.pyc
creating build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying scikit_fmm.egg-info/PKG-INFO -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying scikit_fmm.egg-info/SOURCES.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying scikit_fmm.egg-info/dependency_links.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying scikit_fmm.egg-info/requires.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
copying scikit_fmm.egg-info/top_level.txt -> build/bdist.macosx-10.6-x86_64/egg/EGG-INFO
writing build/bdist.macosx-10.6-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/scikit_fmm-0.0.5dev-py2.6-macosx-10.6-x86_64.egg' and adding 'build/bdist.macosx-10.6-x86_64/egg' to it
removing 'build/bdist.macosx-10.6-x86_64/egg' (and everything under it)
Processing scikit_fmm-0.0.5dev-py2.6-macosx-10.6-x86_64.egg
creating /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scikit_fmm-0.0.5dev-py2.6-macosx-10.6-x86_64.egg
Extracting scikit_fmm-0.0.5dev-py2.6-macosx-10.6-x86_64.egg to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Adding scikit-fmm 0.0.5dev to easy-install.pth file

Installed /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scikit_fmm-0.0.5dev-py2.6-macosx-10.6-x86_64.egg
Processing dependencies for scikit-fmm==0.0.5dev
Searching for numpy==1.6.1
Best match: numpy 1.6.1
Adding numpy 1.6.1 to easy-install.pth file

Using /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Finished processing dependencies for scikit-fmm==0.0.5dev

Thank you so much for your help.
Binod

Jason Furtney

unread,
Dec 29, 2012, 4:14:54 PM12/29/12
to sciki...@googlegroups.com
Binod,

It looks like it is building and installing OK for you. There are no
errors your build or install. I just tried this on OS X 10.6 with
Python 2.7 and everything worked for me.

I have only seen the error message about the cfmm module when python
is run from the directory containing the scikit-fmm source. Just to
make sure this is not the case cd to your home directory and try
importing skfmm again. Here is the example on my machine:

iMac ~/src/scikit-fmm# python setup.py install

iMac ~/src/scikit-fmm# python -c "import skfmm; skfmm.test()"

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "skfmm/__init__.py", line 92, in <module>
from pfmm import distance, travel_time, extension_velocities
File "skfmm/pfmm.py", line 2, in <module>
from cfmm import cFastMarcher
ImportError: No module named cfmm

iMac ~/src/scikit-fmm# cd ~

iMac ~# python -c "import skfmm; skfmm.test()"

**********************************************************************
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikit_fmm-0.0.5dev-py2.7-macosx-10.6-i386.egg/skfmm/__init__.py",
line 244, in skfmm.testing
Failed example:
print phi[2, 2] == phi[2, 3]
Expected:
True
Got:
False
**********************************************************************
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikit_fmm-0.0.5dev-py2.7-macosx-10.6-i386.egg/skfmm/__init__.py",
line 248, in skfmm.testing
Failed example:
print phi[2, 2] == phi[2, 3]
Expected:
True
Got:
False
**********************************************************************
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikit_fmm-0.0.5dev-py2.7-macosx-10.6-i386.egg/skfmm/__init__.py",
line 692, in skfmm.testing
Failed example:
np.testing.assert_allclose(d, exact, atol=1.1*max(dx))
Exception raised:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/doctest.py",
line 1289, in __run
compileflags, 1) in test.globs
File "<doctest skfmm.testing[257]>", line 1, in <module>
np.testing.assert_allclose(d, exact, atol=1.1*max(dx))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/utils.py",
line 1168, in assert_allclose
verbose=verbose, header=header)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/utils.py",
line 636, in assert_array_compare
raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0.044898

(mismatch 100.0%)
x: array([[ 0.92837428, 0.92269046, 0.91693802, ..., 0.91693802,
0.92269046, 0.92837428],
[ 0.89878904, 0.89341754, 0.88797822, ..., 0.88797822,...
y: array([[ 0.91421356, 0.90854544, 0.9029004 , ..., 0.9029004 ,
0.90854544, 0.91421356],
[ 0.88565267, 0.87986723, 0.87410439, ..., 0.87410439,...
**********************************************************************
1 items had failures:
3 of 264 in skfmm.testing
***Test Failed*** 3 failures.
iMac ~#


================

If this does not fix the problem we are going to have to dig a little
deeper. My set up is similar to yours, except I have Python 2.7. I
have tested scikit-fmm on 64-bit computers but I have not tested it
with Python 2.6 or on a 64bit OS X machine.

Note that three of the tests fail in this development version, we have
identified some corner cases and are experimenting with the algorithm.
This version should work fine for your application. You could roll
back to the 0.0.4 release by checking out the 0.0.4 git tag or
downloading the official 0.0.4 release from pypi.

Thanks for the additional info, hopefully we can get the software
working for you soon.
Jason



On Sat, Dec 29, 2012 at 10:19 AM, Binod Thapa-Chhetry
> https://groups.google.com/d/msg/scikit-fmm/-/VGZ64KAEmyQJ.

Binod Thapa-Chhetry

unread,
Jan 2, 2013, 3:43:05 PM1/2/13
to sciki...@googlegroups.com
Hi Jason,

Hope you had a wonderful new year!
As you had suggested, if you import skfmm from anywhere else works, with the exception of the 3 failures that you mentioned. Looks like the module is ready to be used now, and I could actually start working on getting the arrival time and velocity map. So, I have these tensors at each point/voxel that I will be using to determine the speed at that point. I see skfmm.travel_time returns the travel time map. How do I get the velocity map? Do I use skfmm.distance and then divide the distance map with travel time map to get the velocity map? I was also wondering if you could elaborate more about the scope of skfmm.extension_velocities.

Thanks again,
Binod

Jason Furtney

unread,
Jan 3, 2013, 9:30:47 AM1/3/13
to sciki...@googlegroups.com
Binod,

Glad to hear you are up and running and happy new year to you.

All scikit-fmm does is solve the Eikonal equation on a grid. There are
many physical interpretations for this. This book gives a nice summary
of the method and applications (and it describes extension
velocities): http://www.amazon.com/Level-Methods-Fast-Marching-Computational/dp/0521645573

Sorry I cant be more help! Maybe if you describe what you are trying
to do I can point you in the correct direction.

Jason

On Wed, Jan 2, 2013 at 2:43 PM, Binod Thapa-Chhetry
> https://groups.google.com/d/msg/scikit-fmm/-/sQw4iEedMJUJ.

Binod Thapa-Chhetry

unread,
Jan 14, 2013, 5:51:31 PM1/14/13
to sciki...@googlegroups.com
Hi Jason,

Just wanted to confirm with you one thing.
I have an ROI within a 3d matrix. I also have an equation to calculate speed outside this ROI, which is a function of tensor at each point.
So, I should first calculate the value of speed at each point outside this ROI within the 3d matrix, in order to solve for travel_time or extension velocities using skfmm-fmm?

Thank you so much for being patient with me,
Binod

Jason Furtney

unread,
Jan 15, 2013, 10:31:47 AM1/15/13
to sciki...@googlegroups.com
Binod,

No problem, sounds like you have the correct idea. The travel_time
function takes two arrays
phi: described the initial interface location (as the zero contour of phi).
speed: the scalar speed the interface propagates locally at each point.

The result is the travel time from the initial interface to every
point in the grid. So yes convert the tensor values to a scalar speed
first. I am not sure what you mean by ROI; What type of data are you
working with and what physical problem are you trying to solve? If you
have a script file started I would be happy to have a look at it.

Thanks,
Jason

On Mon, Jan 14, 2013 at 4:51 PM, Binod Thapa-Chhetry
> https://groups.google.com/d/msg/scikit-fmm/-/28ewi_3Z7rcJ.

Mathieu Doray

unread,
Apr 2, 2015, 6:19:18 AM4/2/15
to sciki...@googlegroups.com
Hi Jason,

I work on windows7 with Anaconda. I have installed the fmm pre-compiled binary and get the same kind of error as Binod's when loading it:

Q:\>python -c "import skfmm; skfmm.test()"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Anaconda\lib\site-packages\skfmm\__init__.py", line 104, in <module>
    from .pfmm import distance, travel_time, extension_velocities
  File "C:\Anaconda\lib\site-packages\skfmm\pfmm.py", line 4, in <module>
    from .cfmm import cFastMarcher
ImportError: DLL load failed: La procÚdure spÚcifiÚe est introuvable.

Any idea on how do I resolve this issue?

My config: Python 2.7.8 |Anaconda 2.1.0 (32-bit)|

Thanks in advance,

Mathieu

Jason Furtney

unread,
Apr 2, 2015, 10:41:43 AM4/2/15
to sciki...@googlegroups.com
Dear Mathieu Doray,

Did you use the .exe installer from pypi:
https://pypi.python.org/pypi/scikit-fmm ?

I have seen this error message when giving the test command in the
sckit-fmm source directory. Maybe the problem is different in your
case? Can you confirm that your installation has the file
C:\Anaconda\lib\site-packages\skfmm\cfmm.pyd

I think Anaconda comes with minGW so you could try to build scikit-fmm
from source.

Christoph Gohlke recently started providing scikit-fmm binaries:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-fmm

There is a 64bit conda package from Jan Margeta here:
https://binstar.org/jmargeta/scikit-fmm

Thanks,
Jason
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scikit-fmm+...@googlegroups.com.
> To post to this group, send email to sciki...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/scikit-fmm/7cc883df-57bf-4f06-b070-289180288eb8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Mathieu Doray

unread,
Apr 8, 2015, 9:00:12 AM4/8/15
to sciki...@googlegroups.com


Le jeudi 2 avril 2015 16:41:43 UTC+2, Jason Furtney a écrit :
Dear Mathieu Doray,

Did you use the .exe installer from pypi:
https://pypi.python.org/pypi/scikit-fmm ?

yes I did
 
I have seen this error message when giving the test command in the
sckit-fmm source directory. Maybe the problem is different in your
case? Can you confirm that your installation has the file
C:\Anaconda\lib\site-packages\skfmm\cfmm.pyd
yes it does

I think Anaconda comes with minGW so you could try to build scikit-fmm
from source.

Christoph Gohlke recently started providing scikit-fmm binaries:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-fmm

There is a 64bit conda package from Jan Margeta here:
https://binstar.org/jmargeta/scikit-fmm

OK thanks a lot for the answer, I will check this out

Cheers

Mathieu

Jason Furtney

unread,
Apr 8, 2015, 1:49:54 PM4/8/15
to sciki...@googlegroups.com
Dear Mathieu,

Thanks for the reply. I have another idea what the problem may be.

Could you try to cd to C:\Anaconda\lib\site-packages\skfmm\, open an
interactive python interpreter, and type: import cfmm

If this gives the same error, I think the problem relates to
scikit-fmm trying to load the numpy dlls provided by Anaconda. Are you
using the MKL accelerated numpy provided by Anaconda? Maybe scikit-fmm
needs to be build against these specific numpy dlls? If this is the
case, building scikit-fmm from source should work. You can get a
source tarball from pypi or clone the git repo:
https://github.com/scikit-fmm/scikit-fmm. I think minGW comes with
Anaconda so you should be able to do the standard "python setup.py
install" from the scikit-fmm source directory. Remember to cd away
from the scikit-fmm source directory before running the tests. Let me
know how that goes.

Many people seem to be using Anaconda so I will look into creating
Anaconda specific binaries.

Thanks,
Jason
> https://groups.google.com/d/msgid/scikit-fmm/7d62bdf3-9a99-4711-9078-360e729650db%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages