NeuralEnsemble / PyNN

A Python package for simulator-independent specification of neuronal network models.
Other
276 stars 126 forks source link

NEST "object has no attribute 'nest_name'" #674

Closed mattdutson closed 4 years ago

mattdutson commented 4 years ago

I'm running Ubuntu 18.04, Python 3.6, and PyNN 0.9.5. This issue has ocurred both with NEST 2.20 installed through APT and NEST 2.18 built from source.

NEST 2.20 through APT

sudo apt install nest

NEST 2.18 from source

Install build prerequisites as described in the NEST documentation. Then:

wget https://github.com/nest/nest-simulator/archive/v2.18.0.tar.gz
tar -xf v2.18.0.tar.gz
mkdir nest-simulator-2.18.0-build nest-simulator-2.18.0-install
cd nest-simulator-2.18.0-build
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(realpath ../nest-simulator-2.18.0-install) $(realpath ../nest-simulator-2.18.0) -Dwith-python=3
make
make install
source ../nest-simulator-2.18.0-install/bin/nest_vars.sh
make installcheck

Reproducing

conda create --name test python=3.6
conda activate test
pip install six
pip install pyNN==0.9.5

I've also tried pip install --no-binary :all: pyNN==0.9.5 as recommended here.

Then, in a Python prompt:

import pyNN.nest as sim
population = sim.Population(100, sim.cells.IF_curr_exp())

Stack trace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nobackup/dutson/miniconda3/envs/test/lib/python3.6/site-packages/pyNN/nest/populations.py", line 114, in __init__
    super(Population, self).__init__(size, cellclass, cellparams, structure, initial_values, label)
  File "/nobackup/dutson/miniconda3/envs/test/lib/python3.6/site-packages/pyNN/common/populations.py", line 671, in __init__
    self._create_cells()
  File "/nobackup/dutson/miniconda3/envs/test/lib/python3.6/site-packages/pyNN/nest/populations.py", line 123, in _create_cells
    nest_model = self.celltype.nest_name[simulator.state.spike_precision]
AttributeError: 'IF_curr_exp' object has no attribute 'nest_name'
apdavison commented 4 years ago

In general with PyNN you shouldn't access classes from sub-modules, but directly from the top level, i.e. from sim.

The line should be population = sim.Population(100, sim.IF_curr_exp())

mattdutson commented 4 years ago

My mistake. That fixed my issue. Thanks for the reply.