Skip to content

alessandrolapizza/MPC-Course-EPFL

 
 

Repository files navigation

Software setup for MPC course

This class uses Python for the coding exercises and the project. Below you will find instructions for installing a working Python environment and all the libraries that we will use throughout the semester.

Warning

This course previously used Matlab, and transitioning to Python has not been an easy task. Hiccups are to be expected along the way, so do not hesitate to ask questions during exercise sessions or on the forum about any issues or bugs you may find. We will make updates to correct them throughout the semester, and will inform all of you when we do (e.g. to update the libraries).

Setting up the environment

All the exercises and the setup instructions can be found in this repo (https://github.com/PREDICT-EPFL/MPC-Course-EPFL). We will update it regularly to add exercises and fix issues.

The setup will use conda to install Python and create a dedicated environment for the course, and pip to install the required packages. Everything has been tested on macOS, Linux and Windows (not WSL though).

  1. Install git: Make sure you sure you have git installed on your computer. If you don't, please follow the following instructions: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

  2. Clone the repo: Open a terminal and clone the repo (any terminal will do on macOS/Linux, open Git Bash on Windows) at your desired location on your computer.

git clone https://github.com/PREDICT-EPFL/MPC-Course-EPFL.git
  1. Install conda: Install a conda distribution. The simplest for beginners is Anaconda, but any other will do (miniconda, miniforge, etc.). Note that you do not have to create any account to download Anaconda, just skip all registration steps. Once the installation is complete, you should be able to run the following in a new terminal on macOS/Linux or Anaconda Prompt/PowerShell Prompt on Windows:
conda info
  1. Create environment: In the same terminal as before, navigate inside the cloned the repo and create the conda environment with the following commands:
conda create -y -n mpc2025 python=3.12 pip
conda activate mpc2025
pip install -r locked-requirements.txt
  1. Install editor: For beginners, we recommend using Jupyter Lab to edit the notebooks for the programming exercises. It should already be installed with the previous steps, so you can start it by running in the same terminal as before with
jupyter lab

If you prefer using another editor like VSCode or PyCharm, please do! Simply make sure you have installed all the appropriate extensions and make sure that these will not install dependencies in the environment we created (in particular, do not accept notifications offering to install jupyter or ipykernel or pandas and call for help to avoid messing up your environment).

For VSCode, please install the Python and Jupyter extensions, and follow these instructions to associate an environment to the MPC-Course-EPFL folder. Make sure to:

  • always open MPC-Course-EPFL as a folder and not a workspace
  • choose the mpc2025 conda enviroment we have just created
  • if it's not done automatically, use the kernel associated to the mpc2025 environment in every notebook

Testing the environment is properly set up

The best way to test if your installation worked, is to open the first tutorial notebook tutorial.ipynb that will go through some documentation you might want to read to get up to speed with libraries we will use this semester.

  1. Make a copy of the tutorial.ipynb notebook and rename it to my_tutorial.ipynb.
  2. Open Jupyter Lab or VSCode as you did above.
  3. Open the my_tutorial.ipynb notebook and select the kernel in the mpc2025 environment if it's not done automatically.

Updating the libraries

If we ever update the libraries versions and ask you to update your environment:

  1. Open a regular terminal on macOS/Linux or Git Bash on Windows, navigate to this repository and run
git pull
  1. Now open a new terminal on macOS/Linux or Anaconda Prompt/PowerShell Prompt on Windows, activate the environment again and simply reinstall the dependencies:
conda activate mpc2025
pip install -r locked-requirements.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.3%
  • Python 2.7%