Skip to content

Latest commit

 

History

History
224 lines (140 loc) · 11.1 KB

Installation Instructions.md

File metadata and controls

224 lines (140 loc) · 11.1 KB

Installation instructions

The following instructions will show you how to set up your machine in preparation for the course.

Please complete these steps before the course so that we can spend as much time as possible on the course content!


If at any point you get stuck, remember that Google is your friend! You are probably not the only person to ever encounter this issue, so try searching for the error message you are seeing.

If you are unable to find a solution this way, you can get in touch via email and we will try to help.


1. Downloading the course materials

For those who are comfortable using Git, you can of course clone the GitHub repository containing the course materials, e.g.:

git clone https://github.com/tsbinns/mne_course.git

Naturally, you should clone it to a sensible location where you will be able to find it again, e.g. in a folder called GitHub in your home directory.

Cloning the repository will be the easiest way to update the course materials when new content is added each day, so this is recommended.


If you are unfamiliar with Git and cloning repositories from GitHub, GitHub provides a tutorial for doing so (this requires that you have Git installed).

For those who prefer a GUI to working on the command line, you may find the GitHub Desktop programme very useful for cloning the repository.


If you still feel uncomfortable with cloning from GitHub, you can also download the repository as a .zip file. To do this:

  1. Go to the GitHub page for the course repository.

  1. Click the green Code button. A drop-down menu will appear.

  1. On the Local tab of the drop-down menu, click the Download ZIP button, e.g.:
    GitHub Download ZIP

  1. Save the .zip file to a location on your machine where you will be able to find it again, e.g. your Downloads folder.

  1. Extract the contents of the .zip file to a sensible location, e.g. in a folder called GitHub in your home directory.

  1. When downloading a repository from GitHub, it will include the branch name as a suffix, e.g. -main. Remove this suffix from the extracted folder name, so that it is simply mne_course.

In the cloned/downloaded folder, you should see the following contents:
GitHub repository contents


2. Installing Conda

If you already have Conda installed on your machine, you can skip to Section 3.

We will use Conda as our environment manager, offering an easy way to install Python and all the packages we will need for the course.

We will install Conda via the Anaconda distribution. Follow these instructions for installing Anaconda on:


3. Installing Python and MNE

Once Conda has been installed, we will use this to install Python and the packages we will need for the course, such as MNE and its dependencies.

Even if you already have an environment where MNE is installed, please follow these instructions to create a new environment, as there are required features of the most recent MNE versions which you may not have!


  1. Open a terminal from which you can access conda commands, e.g. the Anaconda Prompt.
    There are OS-specific instructions for opening the Anaconda Prompt.
    You should see something like this:
    Anaconda Prompt startup

  1. In the Anaconda Prompt, navigate to the location where you have downloaded the GitHub repository using the cd command, e.g.:
    cd GitHub/mne_course
    
    The exact path will depend on the default directory for your Anaconda Prompt, and the location of the GitHub repository.
    The start of the command line should now show the path to the GitHub repository, e.g.:
    Anaconda Prompt repository path

  1. Create the environment containing Python and install the course dependencies from the environment.yml file, by running the following command in the Anaconda Prompt:
    conda env create --file=environment.yml --solver=libmamba
    
    This will create a new Conda environment called mne_course and install MNE and its dependencies in this environment.
    Be aware that this may take several minutes to run.
    You should see something like this:
    Anaconda Prompt creating environment

  1. Activate the newly-created environment by running the following command in the Anaconda Prompt:
    conda activate mne_course
    
    You should see the name of the environment appear in parentheses at the start of the command line, like this:
    Anaconda Prompt activated environment

  1. Verify that MNE has been installed by running the following command in the Anaconda Prompt:
    python -c "import mne; mne.sys_info()"
    
    You should see something like this:
    Anaconda Prompt check MNE installation

You can now close the Anaconda Prompt.

4. Setting up an IDE for Python and Jupyter notebooks

As the course content is based in Jupyter notebooks, we need an IDE that supports these. We recommend Visual Studio Code (VS Code).

If you prefer to use another IDE, you are welcome to do so, but you will need to adapt the instructions below to your IDE of choice.

If you already have an IDE installed and configured to work with Python and Jupyter notebooks, you can skip to Section 5.


  1. Download VS Code for your OS.
    See also the instructions for installing VS Code on:

    Once installed, open VS Code. You should see something like this:
    VS Code startup


  1. Install the Python extension for VS Code.
    See also these instructions for installing extensions in VS Code.
    You can view your installed extensions by navigating to View > Extensions in the top menu bar, e.g.:
    VS Code estensions tab

  1. Install the Jupyter extension for VS Code.

5. Opening the course materials in the IDE

We will now open the course materials in our IDE.

Again, these instructions are tailored to VS Code, so if you are using a different IDE, you will need to adapt them.


  1. Open the Explorer tab by navigating to View > Explorer in the top menu bar, e.g.:
    VS Code explorer tab

  1. Click on the Open Folder button in the Explorer tab that opens on the left-hand side, and select the folder for the GitHub repository containing the course materials, e.g.:
    VS Code opening repository


    You should now see the course materials in the Explorer tab, e.g.:
    VS Code repository contents


  1. To verify that everything has been installed properly and to check that Jupyter notebooks are supported, open the test notebook file under Notebooks/test_notebook.ipynb in the Explorer tab.
    You should see something like this:
    VS Code test notebook

  1. Activate a kernel which will be used to run the contents of the notebook. This will be the mne_course environment we created earlier.
    Follow these instructions for selecting a kernel in VS Code.
    If the mne_course environment does not appear in the pop-up window, you may find it under Select Another Kernel... > Python Environments... > mne_course.

  1. Run the first cell of the notebook to verify that MNE is available.
    Follow these instructions for running notebook cells in VS Code.
    You should see a set of information output from the cell, similar to that seen in Section 3.

  1. Run the second cell of the notebook to verify that the interactive plotting capabilities of MNE are available, which we will be using during the course.
    You should see a new window be created, containing a 3D plot of a sphere which you can rotate by clicking and dragging with the mouse, e.g.:
    VS Code interactive notebook plot

If you have followed all of these steps, your machine should now be ready to run the course content!