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

Updates to setup.py and other misc tweaks #574

Merged
merged 10 commits into from
Oct 4, 2018

Conversation

sanjayankur31
Copy link
Contributor

@sanjayankur31 sanjayankur31 commented Jun 19, 2018

  • Prefer setuptools if available
  • update setup.py to include run time dependencies, optional dependencies, and dependencies needed by tests.

@coveralls
Copy link

coveralls commented Jun 19, 2018

Coverage Status

Coverage increased (+0.07%) to 42.506% when pulling 378fcc8 on sanjayankur31:update-setup-py into 9775965 on NeuralEnsemble:master.

@sanjayankur31
Copy link
Contributor Author

Failed test:

======================================================================
ERROR: test_simple_stochastic_synapse(nest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/build/NeuralEnsemble/PyNN/test/system/scenarios/test_synapse_types.py", line 25, in test_simple_stochastic_synapse
    synapse_type=synapse_type)
  File "/home/travis/build/NeuralEnsemble/PyNN/pyNN/nest/projections.py", line 47, in __init__
    self.nest_synapse_model = self.synapse_type._get_nest_synapse_model()
  File "/home/travis/build/NeuralEnsemble/PyNN/pyNN/nest/synapses.py", line 42, in _get_nest_synapse_model
    nest.SetDefaults(self.nest_name + '_lbl', synapse_defaults)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nest/lib/hl_api_helper.py", line 231, in stack_checker_func
    return f(*args, **kwargs)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nest/lib/hl_api_models.py", line 123, in SetDefaults
    sr('/{0} exch SetDefaults'.format(model))
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/nest/__init__.py", line 117, in catching_sli_run
    raise _kernel.NESTError(encode(errorstring))
pynestkernel.NESTError: UnknownModelName in SetDefaults_l_D: /simple_stochastic_synapse_lbl is not a known model name. Please check the modeldict for a list of available models.

It seems the nest extensions could not be installed:

Type 'nest.help()' to find out more about NEST.
/home/travis/build/NeuralEnsemble/PyNN/pyNN/nest/__init__.py:55: UserWarning: Unable to install NEST extensions. Certain models may not be available.
Further details: DynamicModuleManagementError in Install: Module 'pynn_extensions' could not be opened.
The dynamic loader returned the following error: 'file not found'.

@apdavison
Copy link
Member

It appears that setuptools is not calling the custom build function. I seem to remember that setuptools handles extensions differently to distutils.

@sanjayankur31
Copy link
Contributor Author

Yes. I just read that too. I reckon something like build_ext must be used. I'll update the PR in a bit. Thanks.

@sanjayankur31
Copy link
Contributor Author

So there appear to be multiple ways of implementing this. One can override build or install or a plethora of other commands. I've done two versions:

  • In this version, I override the build_py bit, which implies that both extensions will be built by default. If install is called, it tries to build them too, but in general, it does not error out if they can't be built. So, the user must manually check if the extensions were successfully built in this scenario. Travis fails for py3.6 somehow

  • In this version, I add the two extensions as optional extensions. setup.py build will not build them, neither will setup.py install. If one requires an extension, it must be manually built by specifying the two new arguments: build_nest_extension and/or build_neuron_extension. This means one can have PyNN core installed without them, or install whichever optional extension one needs. Travis tests all pass.

I'm not entirely sure yet why the test fails for one and not for the other. As far as the tests are concerned, they should be doing identical things.

I cannot find a way to get pip to build the extensions in the second method. The first method should still work.

@sanjayankur31
Copy link
Contributor Author

I've merged the bits that build all the extensions by default, keeping it in line with the previous way the build worked.

@apdavison apdavison merged commit d27c18d into NeuralEnsemble:master Oct 4, 2018
@apdavison
Copy link
Member

Many thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants