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!
- Sections:
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.
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:
- Go to the GitHub page for the course repository.
- Click the green
Code
button. A drop-down menu will appear.
- Save the
.zip
file to a location on your machine where you will be able to find it again, e.g. yourDownloads
folder.
- Extract the contents of the
.zip
file to a sensible location, e.g. in a folder calledGitHub
in your home directory.
- 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 simplymne_course
.
In the cloned/downloaded folder, you should see the following contents:
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:
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!
- 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:
- In the Anaconda Prompt, navigate to the location where you have downloaded the GitHub repository using the
cd
command, e.g.:The exact path will depend on the default directory for your Anaconda Prompt, and the location of the GitHub repository.cd GitHub/mne_course
The start of the command line should now show the path to the GitHub repository, e.g.:
- Create the environment containing Python and install the course dependencies from the
environment.yml
file, by running the following command in the Anaconda Prompt:This will create a new Conda environment calledconda env create --file=environment.yml --solver=libmamba
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:
- Activate the newly-created environment by running the following command in the Anaconda Prompt:
You should see the name of the environment appear in parentheses at the start of the command line, like this:
conda activate mne_course
- Verify that MNE has been installed by running the following command in the Anaconda Prompt:
You should see something like this:
python -c "import mne; mne.sys_info()"
You can now close the Anaconda Prompt.
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.
-
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:
- 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 toView > Extensions
in the top menu bar, e.g.:
- Install the Jupyter extension for VS Code.
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.
-
Click on the
Open Folder
button in theExplorer
tab that opens on the left-hand side, and select the folder for the GitHub repository containing the course materials, e.g.:
You should now see the course materials in the
Explorer
tab, e.g.:
- 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 theExplorer
tab.
You should see something like this:
- 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 themne_course
environment does not appear in the pop-up window, you may find it underSelect Another Kernel... > Python Environments... > mne_course
.
- 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.
- 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.: