Repository: nilearn/nilearn

Issue:
CircleCI: run examples in Python 3
Given the issue #999 #998, it would be a good idea to run the example set in Python 3. Does CircleCI allows build matrix ?

By the way this is the issue #1000, cheers



Discussion:
We can't have a build matrix. That would be too costly. 

I might be convinced to change the default python to 3 on circle,  though

Sent from my phone. Please forgive brevity and mis spelling

On Feb 19, 2016, 15:50, at 15:50, Arthur Mensch notifications@github.com wrote:

> Given the issue #999 #998, it would be a good idea to run the example
> set in Python 3. Does CircleCI allows build matrix ?
> 
> By the way this is the issue #1000, cheers
> 
> ---
> 
> Reply to this email directly or view it on GitHub:
> https://github.com/nilearn/nilearn/issues/1000

@aabadie: since you're on fire with CircleCI, do you mind taking care of this one?

@AlexandreAbraham : sure ! (will be happy to solve the 1K issue :) )

@AlexandreAbraham, @GaelVaroquaux, I made a first try with python 3.4 on circle ci (if we want to keep sphinx version to 1.2.3, this is the python version that works). The output is here: https://circleci.com/gh/aabadie/nilearn/283

There's a warning with one of the decoding example:

```
Traceback (most recent call last):
  File "/home/ubuntu/miniconda2/envs/testenv/lib/python3.4/site-packages/Sphinx-1.2.3-py3.4.egg/sphinx/cmdline.py", line 254, in main
    app.build(force_all, filenames)
  File "/home/ubuntu/miniconda2/envs/testenv/lib/python3.4/site-packages/Sphinx-1.2.3-py3.4.egg/sphinx/application.py", line 220, in build
    self.builder.build_update()
  File "/home/ubuntu/miniconda2/envs/testenv/lib/python3.4/site-packages/Sphinx-1.2.3-py3.4.egg/sphinx/builders/__init__.py", line 214, in build_update
    'out of date' % len(to_build))
  File "/home/ubuntu/miniconda2/envs/testenv/lib/python3.4/site-packages/Sphinx-1.2.3-py3.4.egg/sphinx/builders/__init__.py", line 239, in build
    self.warn(*warning)
  File "/home/ubuntu/miniconda2/envs/testenv/lib/python3.4/site-packages/Sphinx-1.2.3-py3.4.egg/sphinx/application.py", line 268, in warn
    raise SphinxWarning(warntext)
sphinx.errors.SphinxWarning: /home/ubuntu/nilearn/doc/decoding/space_net.rst:None: WARNING: image file not readable: decoding/../auto_examples/02_decoding/images/sphx_glr_plot_mixed_gambles_space_net_002.png


Warning, treated as error:
/home/ubuntu/nilearn/doc/decoding/space_net.rst:None: WARNING: image file not readable: decoding/../auto_examples/02_decoding/images/sphx_glr_plot_mixed_gambles_space_net_002.png
```

Looking at the output log, it seems that the related example is failing: 

```
../examples/02_decoding/plot_mixed_gambles_space_net.py is not compiling:
Traceback (most recent call last):
  File "/home/ubuntu/nilearn/doc/sphinxext/sphinx_gallery/gen_rst.py", line 467, in execute_script
    exec(code_block, example_globals)
  File "<string>", line 1, in <module>
NameError: name 'mask_filename' is not defined
```

The code seems ok to me. Any idea how to fix that ?

Have you tried running the examples examples/02_decoding/plot_mixed_gambles_space_net.py with python 3 ?

> Have you tried running the examples examples/02_decoding/plot_mixed_gambles_space_net.py with python 3 ?

Yes I did and I could solve the issue. But there's another one failing:

```
Traceback (most recent call last):
  File "examples/02_decoding/plot_haxby_space_net.py", line 50, in <module>
    decoder.fit(X_train, y_train)
  File "/home/aabadie/softs/src/nilearn/nilearn/decoding/space_net.py", line 814, in fit
    classifier=self.is_classif))
  File "/home/aabadie/softs/src/scikit-learn/sklearn/cross_validation.py", line 1689, in check_cv
    cv = StratifiedKFold(y, cv)
  File "/home/aabadie/softs/src/scikit-learn/sklearn/cross_validation.py", line 516, in __init__
    len(y), n_folds, shuffle, random_state)
  File "/home/aabadie/softs/src/scikit-learn/sklearn/cross_validation.py", line 256, in __init__
    " than the number of samples: {1}.").format(n_folds, n))
ValueError: Cannot have number of folds n_folds=8 greater than the number of samples: 0.
```

I don't really understand this code so I don't know how to fix this.

Have you seen that @arthurmensch opened the issue #998 and #999? Looks like you fixed #999 already maybe you want to open a PR for it.

@lesteve, opened #1042 to address this issue.


Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -84,7 +84,10 @@
 
 # List of documents that shouldn't be included in the build.
 #unused_docs = []
-exclude_patterns = ['tune_toc.rst', ]
+exclude_patterns = ['tune_toc.rst',
+                    'includes/big_toc_css.rst',
+                    'includes/bigger_toc_css.rst',
+                    ]
 
 # List of directories, relative to source directory, that shouldn't be
 # searched for source files.


Test patch: