Introduction to scientific computing with Python

Installation

Windows and macOS

Install Anaconda for Windows or macOS.

For TensorFlow on recent Mac notebooks, you may need this workaround (thanks to P. Liautaud).

Ubuntu/Debian

You can either install Anacoda for Linux or (favorite option) install python3 with its package manager pip:

sudo apt-get install python3 python3-pip spyder3 ipython3

Before installing a package, make sure that you have the latest version of pip:

sudo pip3 install --upgrade pip

Then, install the required packages manually:

sudo pip3 install jupyterlab numpy scipy matplotlib pillow scikit-learn seaborn pandas statsmodels cvxopt ipympl tensorflow

To launch JupyterLab, write in a shell:

jupyter-lab

Troubleshooting

If you have trouble installing a package, you can use Ubuntu/Debian package manager:

sudo apt-get install python3-[package_name]

If you have trouble performing linear regression with StatsModels, update the package patsy:

sudo pip3 install --upgrade patsy

If the trouble concerns a “distutils installed project”, you can use a downgraded version of pip:

sudo pip3 install --upgrade --force-reinstall pip==9.0.3
sudo pip3 install [package_name] --disable-pip-version-check
sudo pip3 install --upgrade pip

If you have a trouble with interactive plots in JupyterLab (in particular with ipympl), try:

sudo pip3 install --upgrade jupyterlab ipympl
# Install nodejs with those two lines or have a look at https://nodejs.org/en/download/
wget -qO- https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs
sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager
sudo jupyter labextension install jupyter-matplotlib

Material

Schedule

Friday

  • 1-Introduction

  • 2-Plotting

Wednesday

  • 2-Plotting

  • 3-Scientific computing

Thursday

  • 3-Scientific computing

  • 4-Statistics

Friday

  • Exam

  • 6-Convex optimization

Exam 2023

The exam will take place on Friday September 15, 2022, 9h-10h.