mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.67k stars 1.31k forks source link

Failing Examples #689

Closed mainakjas closed 11 years ago

mainakjas commented 11 years ago

I have failing examples when I compile the htmls. Help!

Here is the first traceback:

Traceback (most recent call last):
  File "/home/mainakjas/github/mne-python/doc/sphinxext/gen_rst.py", line 650, in generate_file_rst
    execfile(os.path.basename(src_file), my_globals)
  File "plot_channel_epochs_image.py", line 72, in <module>
    vmax=250, colorbar=True, order=order_func, show=True)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/viz.py", line 1998, in plot_image_epochs
    this_order = order(epochs.times, this_data)
  File "plot_channel_epochs_image.py", line 65, in order_func
    n_components=1, random_state=0).ravel())
  File "/usr/local/lib/python2.7/dist-packages/sklearn/manifold/spectral_embedding.py", line 259, in spectral_embedding
    tol=eigen_tol)
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1536, in eigsh
    symmetric=True, tol=tol)
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1037, in get_OPinv_matvec
    return LuInv(A).matvec
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 932, in __init__
    self.M_lu = lu_factor(M)
  File "/usr/local/lib/python2.7/dist-packages/scipy/linalg/decomp_lu.py", line 58, in lu_factor
    a1 = asarray_chkfinite(a)
  File "/usr/local/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 590, in asarray_chkfinite
    "array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs

Here is the second traceback:

Traceback (most recent call last):
  File "/home/mainakjas/github/mne-python/doc/sphinxext/gen_rst.py", line 650, in generate_file_rst
    execfile(os.path.basename(src_file), my_globals)
  File "plot_ssp_projs_sensitivity_map.py", line 38, in <module>
    ssp_ecg_map.plot(subject='sample', time_label='ECG SSP sensitivity', **args)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/source_estimate.py", line 1384, in plot
    subjects_dir=subjects_dir, figure=figure)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/viz.py", line 1623, in plot_source_estimates
    config_opts=config_opts, subjects_dir=subjects_dir)
  File "/usr/local/lib/python2.7/dist-packages/surfer/viz.py", line 197, in __init__
    self._geo.load_geometry()
  File "/usr/local/lib/python2.7/dist-packages/surfer/io.py", line 493, in load_geometry
    self.coords, self.faces = read_geometry(surf_path)
  File "/usr/local/lib/python2.7/dist-packages/surfer/io.py", line 71, in read_geometry
    with open(filepath, "rb") as fobj:
IOError: [Errno 2] No such file or directory: '/data/freesurfer/subjects/sample/surf/rh.inflated'

where do I get the missing file from?

and lastly something related to unicode characters:

Exception occurred:
  File "/home/mainakjas/github/mne-python/doc/sphinxext/gen_rst.py", line 874, in embed_code_links
    line = line.replace(name, link)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 244: ordinal not in range(128)
agramfort commented 11 years ago

what version of sklearn are you using?

does plot_ssp_projs_sensitivity_map.py run outside of sphinx?

mainakjas commented 11 years ago

version 0.13.1 of sklearn. Yes, it seems to work outside of sphinx. I get some sort of histogram plot.

mainakjas commented 11 years ago

oops no, when I close the histogram plot - it gives the same error.

agramfort commented 11 years ago

even if you run it outside of spyder?

mainakjas commented 11 years ago

yes, even then. I fired up ipython from terminal and ran the example. Yet again, it complains about the missing file.

mainakjas commented 11 years ago

I get a longer traceback now, if it helps:

IOError                                   Traceback (most recent call last)
/usr/local/lib/python2.7/dist-packages/ipython-0.13.2-py2.7.egg/IPython/utils/py3compat.pyc in execfile(fname, *where)
    176             else:
    177                 filename = fname
--> 178             __builtin__.execfile(filename, *where)

/home/mainakjas/github/mne-python/examples/plot_ssp_projs_sensitivity_map.py in <module>()
     36 
     37 args = dict(fmin=0.2, fmid=0.6, fmax=1., smoothing_steps=7, hemi='rh')
---> 38 ssp_ecg_map.plot(subject='sample', time_label='ECG SSP sensitivity', **args)

/home/mainakjas/.local/lib/python2.7/site-packages/mne/source_estimate.pyc in plot(self, subject, surface, hemi, colormap, time_label, smoothing_steps, fmin, fmid, fmax, transparent, alpha, time_viewer, config_opts, subjects_dir, figure)
   1382                         fmax=fmax, transparent=transparent, alpha=alpha,
   1383                         time_viewer=time_viewer, config_opts=config_opts,
-> 1384                         subjects_dir=subjects_dir, figure=figure)
   1385         return brain
   1386 

/home/mainakjas/.local/lib/python2.7/site-packages/mne/viz.pyc in plot_source_estimates(stc, subject, surface, hemi, colormap, time_label, smoothing_steps, fmin, fmid, fmax, transparent, alpha, time_viewer, config_opts, subjects_dir, figure)
   1621         if 'subjects_dir' in args:
   1622             brain = Brain(subject, hemi, surface, title=title, figure=figure,
-> 1623                           config_opts=config_opts, subjects_dir=subjects_dir)
   1624         else:
   1625             # Current PySurfer versions need the SUBJECTS_DIR env. var.

/usr/local/lib/python2.7/dist-packages/surfer/viz.pyc in __init__(self, subject_id, hemi, surf, curv, title, config_opts, figure, subjects_dir)
    195 
    196         # Load in the geometry and (maybe) curvature
--> 197         self._geo.load_geometry()
    198         if curv:
    199             self._geo.load_curvature()

/usr/local/lib/python2.7/dist-packages/surfer/io.pyc in load_geometry(self)
    491         surf_path = pjoin(self.data_path, "surf",
    492                           "%s.%s" % (self.hemi, self.surf))
--> 493         self.coords, self.faces = read_geometry(surf_path)
    494 
    495     @property

/usr/local/lib/python2.7/dist-packages/surfer/io.pyc in read_geometry(filepath)
     69         nfaces x 3 array of defining mesh triangles
     70     """
---> 71     with open(filepath, "rb") as fobj:
     72         magic = _fread3(fobj)
     73         if magic == 16777215:  # Quad file

IOError: [Errno 2] No such file or directory: '/data/freesurfer/subjects/sample/surf/rh.inflated'
agramfort commented 11 years ago

does the file /data/freesurfer/subjects/sample/surf/rh.inflated exist on your system?

my SUBJECTS_DIR folder points to MNE-sample-data/subjects and not to the default freesurfer folder.

mainakjas commented 11 years ago

I see, that solves this error. What about the other one? Do I need to update sklearn?

agramfort commented 11 years ago

I see, that solves this error. What about the other one? Do I need to update sklearn?

it's worth trying. Take the master from github.

mainakjas commented 11 years ago

hmm ... I tried that. Now my sklearn version is '0.14-git' but this doesn't solve the problem.

agramfort commented 11 years ago

hmm ... I tried that. Now my sklearn version is '0.14-git' but this doesn't solve the problem.

can you run the tests of scikit-learn with "make test". Does it pass?

mainakjas commented 11 years ago

out of 608 tests, 49 have errors. But they all point in the same direction. Some missing module called murmurhash. One such error below:

ERROR: Failure: ImportError (No module named murmurhash)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/local/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/mainakjas/github/scikit-learn/sklearn/tests/test_random_projection.py", line 7, in <module>
    from sklearn.metrics import euclidean_distances
  File "/home/mainakjas/github/scikit-learn/sklearn/metrics/__init__.py", line 6, in <module>
    from .metrics import (accuracy_score,
  File "/home/mainakjas/github/scikit-learn/sklearn/metrics/metrics.py", line 26, in <module>
    from ..preprocessing import LabelBinarizer
  File "/home/mainakjas/github/scikit-learn/sklearn/preprocessing.py", line 15, in <module>
    from .utils import check_arrays
  File "/home/mainakjas/github/scikit-learn/sklearn/utils/__init__.py", line 11, in <module>
    from .murmurhash import murmurhash3_32
ImportError: No module named murmurhash
agramfort commented 11 years ago

scikit-learn has some compiled code.

run: "make" in scikit-learn folder. It will build it and run tests.

mainakjas commented 11 years ago

Ah, I see. It complains about missing Blas libraries. Maybe that's the issue.

agramfort commented 11 years ago

see : http://scikit-learn.org/stable/install.html

mainakjas commented 11 years ago

hmm ... running "make" gives me this: http://neuro.hut.fi/~mainak/out_make.txt. The unit tests get stuck and I have to terminate it. I tried the following

sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev sudo apt-get remove libatlas3gf-base libatlas-dev sudo apt-get install libopenblas-dev

but that didn't help

agramfort commented 11 years ago

why do you say it did not help. Built seems ok. Just that nose stopped apparently in the middle of a test.

mainakjas commented 11 years ago

it has a few "NOT AVAILABLE" complaints. Is that ok? Also, doing this hasn't solved my build doc issue which we were trying to address. Just pasting the error again so that you know which one I was referring to:

Traceback (most recent call last):
  File "/home/mainakjas/github/mne-python/doc/sphinxext/gen_rst.py", line 650, in generate_file_rst
    execfile(os.path.basename(src_file), my_globals)
  File "plot_channel_epochs_image.py", line 72, in <module>
    vmax=250, colorbar=True, order=order_func, show=True)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/viz.py", line 1998, in plot_image_epochs
    this_order = order(epochs.times, this_data)
  File "plot_channel_epochs_image.py", line 65, in order_func
    n_components=1, random_state=0).ravel())
  File "/usr/local/lib/python2.7/dist-packages/sklearn/manifold/spectral_embedding.py", line 259, in spectral_embedding
    tol=eigen_tol)
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1536, in eigsh
    symmetric=True, tol=tol)
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1037, in get_OPinv_matvec
    return LuInv(A).matvec
  File "/usr/local/lib/python2.7/dist-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 932, in __init__
    self.M_lu = lu_factor(M)
  File "/usr/local/lib/python2.7/dist-packages/scipy/linalg/decomp_lu.py", line 58, in lu_factor
    a1 = asarray_chkfinite(a)
  File "/usr/local/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 590, in asarray_chkfinite
    "array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs

ps: Just trying out sublime text. It is just amazing !

mainakjas commented 11 years ago

Also nose just got stuck. I had to terminate it because it was stuck. I don't know if that is normal behavior.

agramfort commented 11 years ago

if you only have issues with arpack it's no big deal as you're unlikely to use it.

I see you're good

mainakjas commented 11 years ago

ah ok! it's a very minor issue anyway. Just keeping the issue open for now if anyone finds/ knows of a fix later on.

larsoner commented 11 years ago

I think I'm getting the same error, I seem to remember seeing this a few days ago when I was busy with something else. I might try to track it down.

mainakjas commented 11 years ago

that sounds great @Eric89GXL . Kiitos !

larsoner commented 11 years ago

I get the same error in plot_channel_epochs_image.py. I'm using sklearn 0.13-git that I compiled myself a while ago. I just pulled latest master, re-compiled, and get the same error.

@dengemann @agramfort I don't 100% understand this algorithm, but the problem comes in where order_func calls spectral_embedding. The first argument of spectral_embedding is supposed to be the similarity between elements. My guess is that this matrix may need to be all non-negative (even though it is not documented as such) -- could that be? In any case, if I pass in np.abs(np.corrcoef(this_data)) in place of np.corrcoef(this_data), I don't get an error, so maybe that would work for now... I could see arguments for why a corrcoeff of -1 should really mean things are maximally (as opposed to minimally) similar anyway.

agramfort commented 11 years ago

fixed in master:

b0ab7b2d2c76776567a086d0596ccbaaf861c7c8

I managed to reproduce the error with Canopy

mainakjas commented 11 years ago

Well, this is solved but now I get this:

plot_dics_beamformer.py is not compiling:
Traceback (most recent call last):
  File "/home/mainakjas/github/mne-python/doc/sphinxext/gen_rst.py", line 650, in generate_file_rst
    execfile(os.path.basename(src_file), my_globals)
  File "plot_dics_beamformer.py", line 83, in <module>
    brain = stc.plot(surface='inflated', hemi='rh', subjects_dir=subjects_dir)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/source_estimate.py", line 1389, in plot
    subjects_dir=subjects_dir, figure=figure, views=views)
  File "/home/mainakjas/.local/lib/python2.7/site-packages/mne/viz.py", line 1652, in plot_source_estimates
    views=views)
TypeError: __init__() got an unexpected keyword argument 'views'

after updating the master.

larsoner commented 11 years ago

You need to update your version of PySurfer. @agramfort do you think it's worth me adding version checking so people don't hit this problem if they're running an older version?

agramfort commented 11 years ago

yes please add version checking. The new version of PySurfer needs to be released. Do you want to take care of it? It's just a matter of bumping version number, building the doc, creating the tag and maintenance branch and doing a python setup sdist upload. I am giving you commit rights on PySurfer now. If you have an account on PiPy let me know.

On Mon, Aug 26, 2013 at 5:06 PM, Eric89GXL notifications@github.com wrote:

You need to update your version of PySurfer. @agramforthttps://github.com/agramfortdo you think it's worth me adding version checking so people don't hit this problem if they're running an older version?

— Reply to this email directly or view it on GitHubhttps://github.com/mne-tools/mne-python/issues/689#issuecomment-23269016 .

larsoner commented 11 years ago

Okay, I'll give it a shot (first time). Just made an account on PyPi, Eric89GXL.

agramfort commented 11 years ago

@Eric89GXL you should be good with pipy. We'll have to send an email to the nipy ml afterwards

larsoner commented 11 years ago

@mainakjas could you try my branch Eric89GXL/pysurfer-vers? It contains a fix (see #733).

larsoner commented 11 years ago

@agramfort I will probably try releasing PySurfer next week if nobody beats me to it in the meantime.

mainakjas commented 11 years ago

Thanks @Eric89GXL . I had actually tried pip install --upgrade pysurfer but I think that won't work unless it is released. Using the latest master branch from github solved my problem. Closing this issue now.

larsoner commented 11 years ago

@mainakjas I have pushed an updated version to Pypi, feel free to try pip again.

mainakjas commented 11 years ago

thanks @Eric89GXL !

Irving-ren commented 6 years ago

Hi, I just got in touch with mne.decoding.csp Recently. the code i used is the same with demo (https://martinos.org/mne/stable/auto_examples/decoding/plot_decoding_csp_eeg.html) , and the data_t of Demo is a (45, 64, 161) matrix and the label_V of Demo is a (45,) matrix. Then, the demo works well.However, after applying this code to my data,which the data_t was changed to (1280, 32, 8064) matrix and label_V to (1280,) matrix. the same error that mentioned above was occurred. screenshot from 2018-08-21 13-33-44 screenshot from 2018-08-21 13-34-34 the environment i worked is on the numpy 1.15.0 and sklearn 0.19.1 of Ubuntu Anaconda python 3.5. Is this problem related with the numpy or sklearn version? Does anyone know the reason of this error? which is strange because the array of my data didn't include any infs or NaNs. Thanks a lot!

agramfort commented 6 years ago

why do you have tensorflow code in an MNE example?

Irving-ren commented 6 years ago

Thanks for your reply. the file name is called tf code. In fact, some of codes is not related with tf, just using sklearn.