Changes for page 02. Installing PyNN - Linux
Last modified by adavison on 2022/10/04 13:53
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -6,7 +6,7 @@ 6 6 7 7 == Learning objectives == 8 8 9 -In this tutorial, you will learn how to install PyNN, together with the NEST, NEURON and Brian2 simulators, on Linux / Mac OS / Windows / in EBRAINS Jupyter Lab. 9 +In this tutorial, you will learn how to install PyNN, together with the NEST, NEURON and Brian 2 simulators, on Linux / Mac OS / Windows / in EBRAINS Jupyter Lab. 10 10 11 11 (% class="box infomessage" %) 12 12 ((( ... ... @@ -19,17 +19,11 @@ 19 19 20 20 == Prerequisites == 21 21 22 -To follow this tutorial, you will need a computer with [Linux/MacOS/Windows]and a good network connection. You will need to know how to open the terminal application for your operating system.22 +To follow this tutorial, you will need a computer with Linux and a good network connection. You will need to know how to open the terminal application for your operating system. 23 23 24 - 25 -OR 26 - 27 - 28 -To follow this tutorial, you will need an EBRAINS account. You should know how to create and use Jupyter notebooks in the EBRAINS Jupyter Lab. 29 - 30 30 == Format == 31 31 32 -These tutorials will be screencasts, in which the presenter runs commands in a terminal (or in a Jupyer notebook), and the viewer is expected to follow along. The intended duration is 10 minutes.For the Jupyter version of the tutorial, the final notebook will also be made available.26 +These tutorials will be screencasts, in which the presenter runs commands in a terminal, and the viewer is expected to follow along. The intended duration is 10-15 minutes. 33 33 34 34 == Script == 35 35 ... ... @@ -117,6 +117,12 @@ 117 117 118 118 Notice how this changes the command prompt to show the name of your virtual environment. In our case, we had named it 'pynn_env', and this is now reflected as a prefix to the command prompt. This confirms that we are now in our new virtual environment. 119 119 114 +(% class="box warningmessage" %) 115 +((( 116 +**Note:** 117 +\\You might be required to run the above command every time you open a new terminal window. Do verify that the terminal command prompt indicates the name of your virtual environment to confirm that you have indeed activated it. 118 +))) 119 + 120 120 Now that we have our project's virtual environment setup, we are now ready to install PyNN and other simulators. In general, it is advisable to install the various simulators (especially NEURON and NEST) prior to installing PyNN, because PyNN will then auto compile NEURON's NMODL fles and NEST's extensions during installation. Alternatively, this would need to be done manually as described on the PyNN website. In this tutorial, we will adopt the easier approach and begin by installing the simulators. For the purposes of this tutorial, we shall demonstrate the installation of Brian2, NEURON and NEST simulators. 121 121 122 122 We start here with the installation of Brian 2. Brian 2 can be installed simply using the pip command. ... ... @@ -147,11 +147,10 @@ 147 147 148 148 If there are no error messages here, and the import is successful, then we have completed installing Brian 2. 149 149 150 +We shall now move on to install the NEST simulator. Unlike Brian 2, NEST is not a Python package and therefore it cannot be installed via the 'pip' command. 150 150 151 - Weshallnowmove ontoinstalltheNEST simulator. UnlikeBrian2,NEST is notaPythonpackage andtherefore itsonisa bitmorevolved.WeshallinstallheNESTmodule alongwith PyNEST,whichisaPythoninterface for controllingtheNESTkernel.152 +At the time of creating this tutorial, the lastest version of NEST is v3.1. This is currently supported by PyNN v0.10, and it is likely that other versions of NEST could potentially be incompatible with this version of PyNN. The installation is done by first adding the PPA repository for NEST and updating apt, followed by the installation of NEST itself. 152 152 153 -We first install the NEST module. At the time of creating this tutorial, the lastest version of NEST is 3.1. This is supported by is currently supported by PyNN, and it is likely that other versions of NEST might have issues when used with the current version of PyNN. The installation is done by first adding the PPA repository for NEST and updating apt, followed by the installation of NEST itself. 154 - 155 155 (% class="box infomessage" %) 156 156 ((( 157 157 **Screencast** - terminal ... ... @@ -160,10 +160,60 @@ 160 160 \\sudo apt-get install nest 161 161 ))) 162 162 163 - At thispoint, we have installedthe NEST module,butit isstill not usable via Python. Todoso,wenextinstallPyNEST.162 +This installs the NEST module along with PyNEST, which is a Python interface for controlling the NEST kernel. This allows us to use NEST via Python. To confirm that we have properly installed NEST on our computer, we can test as follows: 164 164 164 +(% class="box infomessage" %) 165 +((( 166 +**Screencast** - terminal 167 +\\(% style="color:#000000" %)nest 168 +))) 165 165 170 +This will display the NEST banner, which mentions the version amongst other info. Here, as we can see, we have now installed NEST v3.1 on our system. Let us next verify that this is indeed accessible via Python. 166 166 172 +(% class="box infomessage" %) 173 +((( 174 +**Screencast** - terminal 175 +\\(% style="color:#000000" %)python3 176 +\\import nest 177 +\\exit() 178 +))) 179 + 180 +(% class="box warningmessage" %) 181 +((( 182 +**Note:** 183 +\\I find that I receive a "no module named nest" error, when trying this right after installing NEST. But it succeeds after a restart. So if you do observe an error, close all programs and restart your computer, and try again. This time it should execute as expected. 184 +))) 185 + 186 +If there are no error messages here, and the import is successful, then we have completed installing NEST simulator, and are able to load it on Python. 187 + 188 +We next move on to the third simulator, NEURON. The installation for NEURON used to be more involved previously, but can now be easily completed using the 'pip' command: 189 + 190 +(% class="box infomessage" %) 191 +((( 192 +**Screencast** - terminal 193 +\\(% style="color:#000000" %)pip install neuron 194 +))) 195 + 196 +This installs the NEURON simulator on your system. To confirm that we have properly installed NEURON, we can test as follows: 197 + 198 +(% class="box infomessage" %) 199 +((( 200 +**Screencast** - terminal 201 +\\(% style="color:#000000" %)nrngui 202 +))) 203 + 204 +This will display the NEURON banner, which mentions the version amongst other info. Here, as we can see, we have now installed NEURON v8.0.0 on our system. Let us next verify that this is indeed accessible via Python. 205 + 206 +(% class="box infomessage" %) 207 +((( 208 +**Screencast** - terminal 209 +\\(% style="color:#000000" %)python3 210 +\\from neuron import h 211 +\\exit() 212 +))) 213 + 214 + 215 + 167 167 (% class="box successmessage" %) 168 168 ((( 169 169 **Slide** recap of learning objectives