Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix travis build and tests with mock data #571

Closed

Conversation

sanjayankur31
Copy link
Contributor

Various updates to the travis configurations to get the install.sh script to properly install pynn, nest and other deps required to run the tests. The tests still fail, but not because the build requirements cannot be installed. These are the failed tests that one can now work on:

 bash ci/test_script.sh
..................E.............................SSSSSS..S..S.........................................SSSSS..S..S.........................................SS.............................SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS..........................................................E........E......................E..........................E.....................E............................................................SS.............................................
======================================================================
ERROR: test_get_data_with_gather (unittests.test_assembly.AssemblyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_assembly.py", line 402, in test_get_data_with_gather
    data = a.get_data(gather=True)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 1318, in get_data
    blocks = [p.get_data(variables, gather, clear) for p in self.populations]
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 1318, in <listcomp>
    blocks = [p.get_data(variables, gather, clear) for p in self.populations]
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population36', initialising v to -65.0
PyNN: DEBUG: In Population 'population36', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population36', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population37', initialising v to -65.0
PyNN: DEBUG: In Population 'population37', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population37', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population38', initialising v to -70.6
PyNN: DEBUG: In Population 'population38', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population38', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population38', initialising w to 0.0
PyNN: DEBUG: population38.record('v')
PyNN: DEBUG: Recorder.record(<3 cells>)
PyNN: DEBUG: population36.record('v')
PyNN: DEBUG: Recorder.record(<11 cells>)
PyNN: DEBUG: population37.record('v')
PyNN: DEBUG: Recorder.record(<6 cells>)
PyNN: DEBUG: 0 **** ids=[59 60 61], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9e434cd68>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9d2886e80> to cache
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9e434ce10>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9e434ceb8> to cache
PyNN: DEBUG: 0 **** ids=[53 54 55 56 57 58], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9e434cdd8>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9e434ce48> to cache
PyNN: DEBUG: population38.record('spikes')
PyNN: DEBUG: Recorder.record(<3 cells>)
PyNN: DEBUG: population36.record('spikes')
PyNN: DEBUG: Recorder.record(<11 cells>)
PyNN: DEBUG: population37.record('spikes')
PyNN: DEBUG: Recorder.record(<6 cells>)
PyNN: DEBUG: population38.record('w')
PyNN: DEBUG: Recorder.record(<3 cells>)
PyNN: DEBUG: 0 **** ids=[59 60 61], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d2886cc0>
PyNN: DEBUG: 0 **** ids=[59 60 61], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d2886ba8>
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_get_data_with_gather (unittests.test_population.PopulationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_population.py", line 503, in test_get_data_with_gather
    data = p.get_data(gather=True)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population295', initialising v to -70.6
PyNN: DEBUG: In Population 'population295', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population295', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population295', initialising w to 0.0
PyNN: DEBUG: population295.record('v')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26bd7b8>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9d26bd828> to cache
PyNN: DEBUG: population295.record('spikes')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: population295.record('w')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26bd6d8>
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26bd9b0>
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_get_spikes_with_gather (unittests.test_population.PopulationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_population.py", line 539, in test_get_spikes_with_gather
    data = p.get_data(gather=True)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population304', initialising v to -70.6
PyNN: DEBUG: In Population 'population304', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population304', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population304', initialising w to 0.0
PyNN: DEBUG: population304.record('v')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26dab70>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9d26dabe0> to cache
PyNN: DEBUG: population304.record('spikes')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: population304.record('w')
PyNN: DEBUG: Recorder.record(<14 cells>)
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26daa90>
PyNN: DEBUG: 0 **** ids=[42 43 44 45 46 47 48 49 50 51 52 53 54 55], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26dad68>
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_record_with_v_and_spikes (unittests.test_population.PopulationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_population.py", line 455, in test_record_with_v_and_spikes
    data = p.get_data(gather=True).segments[0]
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population328', initialising v to -70.6
PyNN: DEBUG: In Population 'population328', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population328', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population328', initialising w to 0.0
PyNN: DEBUG: population328.record('('v', 'spikes')')
PyNN: DEBUG: Recorder.record(<2 cells>)
PyNN: DEBUG: 0 **** ids=[42 43], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d268df60>
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_get_data_with_gather (unittests.test_populationview.PopulationViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_populationview.py", line 532, in test_get_data_with_gather
    data = p.get_data(gather=True)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population358', initialising v to -70.6
PyNN: DEBUG: In Population 'population358', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population358', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population358', initialising w to 0.0
PyNN: DEBUG: view of 'population358' with size 5.record('v')
PyNN: DEBUG: Recorder.record(<5 cells>)
PyNN: DEBUG: 0 **** ids=[42 45 48 51 54], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d264dc50>
PyNN: DEBUG: Adding <neo.core.segment.Segment object at 0x7fb9d264db70> to cache
PyNN: DEBUG: view of 'population358' with size 5.record('spikes')
PyNN: DEBUG: Recorder.record(<5 cells>)
PyNN: DEBUG: view of 'population358' with size 5.record('w')
PyNN: DEBUG: Recorder.record(<5 cells>)
PyNN: DEBUG: 0 **** ids=[42 45 48 51 54], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d264dc18>
PyNN: DEBUG: 0 **** ids=[42 45 48 51 54], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d264dc88>
--------------------- >> end captured logging << ---------------------
======================================================================
ERROR: test_record_with_v_spikes (unittests.test_populationview.PopulationViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/sanjayankur31/PyNN/test/unittests/test_populationview.py", line 443, in test_record_with_v_spikes
    data = p.get_data(gather=True).segments[0]
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/common/populations.py", line 507, in get_data
    return self.recorder.get(variables, gather, self._record_filter, clear)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 302, in get
    data.segments.append(self._get_current_segment(filter_ids=filter_ids, variables=variables, clear=clear))
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/recording/__init__.py", line 257, in _get_current_segment
    data = self._get_spiketimes(sids)
  File "/home/travis/build/sanjayankur31/PyNN/pyNN/mock/recording.py", line 13, in _get_spiketimes
    return numpy.array([id, id + 5], dtype=float) % self._simulator.state.t
nose.proxy.TypeError: can only concatenate list (not "int") to list
-------------------- >> begin captured logging << --------------------
PyNN: DEBUG: In Population 'population380', initialising v to -70.6
PyNN: DEBUG: In Population 'population380', initialising gsyn_exc to 0.0
PyNN: DEBUG: In Population 'population380', initialising gsyn_inh to 0.0
PyNN: DEBUG: In Population 'population380', initialising w to 0.0
PyNN: DEBUG: view of 'population380' with size 2.record('('v', 'spikes')')
PyNN: DEBUG: Recorder.record(<2 cells>)
PyNN: DEBUG: 0 **** ids=[42 45], channels=<neo.core.channelindex.ChannelIndex object at 0x7fb9d26030b8>
--------------------- >> end captured logging << ---------------------
----------------------------------------------------------------------
Ran 481 tests in 1.594s
FAILED (SKIP=69, errors=6)

@sanjayankur31
Copy link
Contributor Author

The errors are related to the mock simulator---probably something trivial. The one here, for example, is only because the variable id is a list and not a numpy.array. If one fixes it by upgrading it to a numpy.array, for example by doing: [numpy.array(id), numpy.array(id) + 5], it doesn't error any more, but moves on and errors somewhere else with the same issue---that a variable is of a list type instead of a numpy.array.

@sanjayankur31 sanjayankur31 changed the title Update travis configuration Fix travis build and tests with mock data Jun 14, 2018
@sanjayankur31
Copy link
Contributor Author

sanjayankur31 commented Jun 14, 2018

Some tests related to NEST and neuron too are failing. The build bit etc. now works.

Copy link
Member

@apdavison apdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this PR. Unfortunately I had already fixed some of the bugs in my own fork but forgot to push it to upstream.

I would be interested to receive a new PR with the changes to setup.py

env: PYENV=py35
python:
- 2.7
- 3.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to test with an older version of Python 3 (3.3 or 3.4), since HPC environments do not always have recent versions available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, of course. I'm not modifying the .travis.yml file now, so it'll be as you left it.

@@ -5,3 +5,7 @@ numpy>=1.8.2
quantities>=0.12.1
lazyarray>=0.3.2
neo>=0.5.2
setuptools
matplotlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matplotlib, scipy and even mpi4py are optional, they are not strict requirements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'd done a quick grep of the code and found this:

$ grep -nri "matplotlib" *
doc/pyplots/continuous_time_spiking.py:3:import matplotlib.pyplot as plt
doc/pyplots/reset_example.py:2:import matplotlib.pyplot as plt
doc/pyplots/neo_example.py:2:import matplotlib.pyplot as plt
doc/pyplots/plot_helper.py:5:import matplotlib.pyplot as plt
doc/data_handling.txt:132:Plotting Neo data with Matplotlib, as shown above, can be rather verbose, with
doc/data_handling.txt:137:highly-customized plots you should probably use Matplotlib or some other
doc/developers/contributing.txt:29:    * matplotlib
doc/developers/contributing.txt:263:.. _matplotlib: http://matplotlib.sourceforge.net/
doc/conf.py:21:    # also, the matplotlib figures need the real modules.
doc/conf.py:55:#              'matplotlib.sphinxext.only_directives',
doc/conf.py:56:#              'matplotlib.sphinxext.plot_directive'
examples/random_distributions.py:7:import matplotlib.pyplot as plt
examples/random_distributions.py:8:import matplotlib.gridspec as gridspec
examples/HH_cond_exp2.py:58:        import matplotlib.pyplot as plt
examples/stochastic_synapses.py:7:import matplotlib
examples/stochastic_synapses.py:8:matplotlib.use('Agg')
examples/stochastic_deterministic_comparison.py:7:import matplotlib
examples/stochastic_deterministic_comparison.py:8:matplotlib.use('Agg')
Binary file examples/iaf_sfa_relref/myFigure_expected.pdf matches
examples/stochastic_tsodyksmarkram.py:17:import matplotlib
examples/stochastic_tsodyksmarkram.py:18:matplotlib.use('Agg')
examples/tools/VAbenchmark_graphs.py:23:import matplotlib.pyplot as plt
examples/tools/VAbenchmark_graphs.py:24:import matplotlib.gridspec as gridspec
examples/tools/comparison_plot.py:13:import matplotlib.pyplot as plt
examples/tools/comparison_plot.py:14:import matplotlib.gridspec as gridspec
examples/tools/comparison_plot.py:50:    #   also consider adding metadata to PNG file - see http://stackoverflow.com/questions/10532614/can-matplotlib-add-metadata-to-saved-figures
examples/tools/plot_results.py:16:import matplotlib.pyplot as plt
examples/Potjans2014/README.txt:90:matplotlib 0.99.1.1, and glob.
examples/Potjans2014/plotting.py:2:import matplotlib
examples/Potjans2014/plotting.py:3:matplotlib.use('Agg')
examples/Potjans2014/plotting.py:4:import matplotlib.pyplot as plt
examples/multiquantal_synapses.py:7:import matplotlib
examples/multiquantal_synapses.py:8:matplotlib.use('Agg')
examples/gif_neuron.py:20:import matplotlib
examples/gif_neuron.py:21:matplotlib.use('Agg')
pyNN/utility/plotting.py:6:figures, it will probably be easier to use matplotlib or another plotting
pyNN/utility/plotting.py:18:import matplotlib.pyplot as plt
pyNN/utility/plotting.py:19:import matplotlib.gridspec as gridspec
pyNN/utility/plotting.py:223:    A panel is a Matplotlib Axes or Subplot instance. A data item may be an
pyNN/utility/plotting.py:228:    Valid options are any valid Matplotlib formatting options that should be
pyNN/utility/plotting.py:234:            a list of dicts containing Matplotlib formatting options, of the
test/benchmarks/plot_figure.py:21:import matplotlib.pyplot as plt
test/benchmarks/plot_figure.py:22:import matplotlib.gridspec as gridspec
test/system/scenarios/test_synapse_types.py:33:        import matplotlib.pyplot as plt
test/system/scenarios/test_cell_types.py:28:        import matplotlib.pyplot as plt
test/system/scenarios/test_cell_types.py:88:        import matplotlib.pyplot as plt
test/system/scenarios/test_cell_types.py:118:        import matplotlib.pyplot as plt
test/system/scenarios/test_cell_types.py:170:        import matplotlib.pyplot as plt
test/system/scenarios/test_cell_types.py:226:        import matplotlib.pyplot as plt
test/system/scenarios/ticket166.py:43:        import matplotlib.pyplot as plt

So it seems to be at least imported in a lot of tests, and possibly used in quite a few examples. Should I leave it in the requirements file so that it's available to the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, mpi4py and scipy are required by a few tests, so I reckon they should be in requirements.txt if not in setup.py

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a strong preference for keeping requirements.txt minimal - only what is needed to install the core functionality.

This preference may be outdated - it is from the time before widespread adoption of wheels, when pip-installing scipy or matplotlib would often result in compilation from source, taking 20 minutes or more. This was the case probably only two years ago, although I agree the situation currently is greatly improved.

How about a file requirements_testing.txt and/or requirements_extras.txt, and using the tests_require keyword of setuptools in setup.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, that sounds like a good idea. I'll update the PR I just opened.

@@ -108,5 +111,6 @@ def find(self, command):
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering'],
cmdclass={'build': build},
install_requires=['numpy>=1.8.2', 'lazyarray>=0.3.2', 'matplotlib',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matplotlib is not required, it is optional for the core PyNN functionality

@apdavison apdavison closed this Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants