This is a repository for Neural Dynamics course. To install the dependencies, follow this instructions: .. _setup:
To solve the exercises you need to install Python
, the Brian2
simulator and the neurodynex3
package. The tutorial below will explain two different ways of installing everything:
-
using the :ref:
pip <setup-pip>
package manager (Linux, macOS) -
using the :ref:
conda <setup-conda>
package manager, if you have Anaconda installed (Linux, macOS, Windows).
In both cases, we will use the package manager to create a virtual environment called bmnn
and install everything there.
.. _setup-pip:
-
We will start by creating a virtual environemt that contains a separate Python installation. To do this, we first need the
virtualenv
package. Install this by running:.. code-block:: bash
pip install virtualenv
-
Now create the virtual environment in a folder called
bmnn
:.. code-block:: bash
virtualenv bmnn
-
Activate the virtual environment:
.. code-block:: bash
source bmnn/bin/activate
-
Now install
neurodynex3
and all its requirements:.. code-block:: bash
pip install --upgrade neurodynex3 pip install jupyter
-
You can now use Python in this environment as you normally would. Move to the folder where you want your code to be stored and start a Jupyter notebook by running:
.. code-block:: bash
cd your_folder jupyter notebook
-
Finally, when you are done using the virtual environment, you can deactivate it:
.. code-block:: bash
deactivate
.. note::
If something goes wrong inside the virtual environment, you can simply delete it by removing its folder (with the regular rm -r
command) and start over:
.. code-block:: bash
>> deactivate
>> rm -r bmnn
.. _setup-conda:
Anaconda <https://www.anaconda.com/distribution/>
_ is a Python distribution that can be installed on Linux, macOS, and Windows. It comes together with a package manager called conda
. To run conda
commands if you are using Windows, first start the Anaconda Prompt
.
.. image:: setup_images/anaconda-prompt.png :align: center
If you are using Linux or macOS, you can run conda
commands in a regular terminal.
-
We start by creating a virtual environemt that contains a separate Python installation. The virtual environment is called
bmnn
:.. code-block:: bash
conda create --name bmnn python
-
Activate the virtual environment:
.. code-block:: bash
conda activate bmnn
-
Now install required Python packages:
.. code-block:: bash
conda install numpy scipy jupyter matplotlib mpmath setuptools setuptools_scm mock nose
-
Install
Brian2
:.. code-block:: bash
conda install -c conda-forge brian2
-
We will now install
neurodynex3
. Note: this step is done usingpip
, notconda
. First make sure that you are usingpip
inside the virtual environment:.. code-block:: bash
pip --version pip 20.0.2 from //anaconda3/envs/bmnn/.../pip (python 3.8)
-
Now run the install command:
.. code-block:: bash
pip install neurodynex3
-
You can now use Python in this environment as you normally would. Move to the folder where you want your code to be stored and start a Jupyter notebook by running:
.. code-block:: bash
cd your_folder jupyter notebook
-
Finally, when you are done using the virtual environment, you can deactivate it:
.. code-block:: bash
conda deactivate
.. note::
If something goes wrong inside the virtual environment, you can simply delete it and start over:
.. code-block:: bash
>> conda deactivate
>> conda remove --name bmnn --all
More information can be found in the conda documentation <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>
_.
.. _setup-jupyter:
Here are some useful links to get started with Python and Brian:
Python documentation <https://www.python.org/doc>
_Brian2 documentation <https://brian2.readthedocs.io/en/stable>
_Jupyter notebook documentation <https://jupyter-notebook.readthedocs.io/en/stable>
_Matplotlib documentation <https://matplotlib.org/tutorials/index.html>
_conda documentation <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>
_