Skip to content

Latest commit

 

History

History
1133 lines (698 loc) · 43.7 KB

File metadata and controls

1133 lines (698 loc) · 43.7 KB

Setup instructions

Below are the instructions for setting up your computer for the Le Wagon Data Science & AI bootcamp.

Please read them carefully and execute all commands in the following order.

This setup is not an exercise; its sole purpose is to prepare your machine in a standardised way. Do not experiment or ask an LLM for help. If you get stuck, simply ask a teacher for help 🙋

Let's start 🚀

GitHub account

Have you signed up to GitHub? If not, do it right away.

👉 Upload a picture and put your name correctly on your GitHub account. This is important as we'll use an internal dashboard with your avatar. Please do this now, before you continue with this guide.

GitHub picture

👉 Enable Two-Factor Authentication (2FA). GitHub will send you text messages with a code when you try to log in. This is important for security and also will soon be required in order to contribute code on GitHub.

SSH key

We want to safely communicate with your virtual machine using SSH protocol. We need to generate a SSH key to authenticate.

  • Open your terminal
💡 Windows tip

We highly recommend installing Windows Terminal from the Windows Store (installed on Windows 11 by default) to perform this operation

  • Create a SSH key
Windows
# replace your_email@example.com, this is purely informative and allows you to remember the use of this key
ssh-keygen.exe -t ed25519 -C your_email@example.com
MacOS & Linux
# replace your_email@example.com, this is purely informative and allows you to remember the use of this key
ssh-keygen -t ed25519 -C your_email@example.com

You should get the following message: > Generating public/private algorithm key pair.

  • When you are prompted > Enter a file in which to save the key, press Enter
  • You should be asked to Enter a passphrase - this is optional if you want additional security. To continue without a passphrase press enter without typing anything when asked to enter a passphrase.

ℹ️ Don't worry if nothing prompt when you type, that is perfectly normal for security reasons.

  • You should be asked to Enter same passphrase again, do it.

❗️ You must remember this passphrase.

❗️ /home/your_username/.ssh/id_ed25519 already exists. If you receive this message, you may already have an SSH Key with the same name (if you are a Le Wagon Alumni or are using SSH Authentication with Github).

To create a separate SSH key to exclusively use for this bootcamp use the following:

# replace your_email@example.com, this is purely informative and allows you to remember the use of this key
ssh-keygen -t ed25519 -f ~/.ssh/ds-bootcamp -C your_email@example.com

Your new SSH Key will be named ds-bootcamp. Make sure to remember it for later!

Google Cloud Platform setup

GCP is a cloud solution that you are going to use in order to work on a virtual machine.

Project setup

👌 Note: Skip to the next section if you already have a GCP project

  • Go to Google Cloud and create an account if you do not already have one
  • In the Cloud Console, on the project list, select or create a Cloud project

  • Give it a name such as Wagon Bootcamp for example
  • Notice the ID automatically created for the project, e.g. wagon-bootcamp-123456

Account language

In order to facilitate the following of the instructions during the bootcamp, open your GCP account preferences:

https://myaccount.google.com/language

If the preferred language is not:

  • English
  • United States

Then switch the language to english:

  • Click on the edit pen logo
  • Select English
  • Select United States
  • Click on Select

Billing account

👌 Note: Skip to the next section if you already have a valid billing account

You will now link your account to your credit card. This step is required or you will not be able to use the services provided by GCP. Do not worry, you will be able to consume most GCP services through free credits throughout the bootcamp.

  • Click on Billing
  • Click on MANAGE BILLING ACCOUNTS
  • Click on ADD BILLING ACCOUNT
  • Give a name to your billing account, e.g. My Billing Account
  • Click on "I have read..." and agree the to the terms of service
  • Click on CONTINUE
  • Select your account type: Individual
  • Fill your name and address

You should see that you have a free credit of "$300 credits over the next 90days".

  • Click on card details
  • Enter your credit card info
  • Click on START MY FREE TRIAL

Once this is done, verify that your billing account is linked to your GCP project.

  • Select your project
  • Go to Billing
  • Select LINK A BILLING ACCOUNT
  • Select My Billing Account
  • Click on SET ACCOUNT

You should now see:

Free trial status: $300 credit and 91 days remaining - with a full account, you'll get unlimited access to all of Google Cloud Platform.
👉 If you do not own a credit card 👈

If you do not own a credit card, an alternative is to setup a Revolut account. Revolut is a financial app that will allow you to create a virtual credit card linked to your mobile phone billing account.

Skip this step if you own a credit card and use your credit card for the setup.

Download the Revolut app, or go to revolut and follow the steps to download the app (enter your mobile phone number and click on Get Started).

  • Open the Revolut app
  • Enter your mobile phone number
  • Enter the verification code received by SMS
  • The app will ask for your country, address, first and last name, date of birth, email address
  • The app will also ask for a selfie and request your profession
  • The app will require a photo of your identification card or passport

Once this is done, select the standard (free) plan. No need to add the card to Apple pay, or ask for a the delivery of a physical card, or add money securely.

You now have a virtual card which we will use for the GCP setup.

In the main view of the Revolut the app

  • Click on Ready to use
  • Click on the card
  • Click on Show card details
  • Note down the references of the virtual credit card and use them in order to proceed with the GCP setup
👉 If you receive an email from Google saying "Urgent: your billing account XXXXXX-XXXXXX-XXXXXX has been suspended" 👈

This may happen especially in case you just setup a Revolut account.

  • Click on PROCEED TO VERIFICATION
  • You will be asked to send a picture of your credit card (only the last 4 digits, no other info)
  • In case you used Revolut, you can send a screenshot of your virtual credit card (do not forget to remove the validity date from the screenshot)
  • Explain that you are attending the Le Wagon bootcamp, do not own a credit card, and have just created a Revolut account in order to setup GCP for the bootcamp using a virtual credit card

You may receive a validation or requests for more information within 30 minutes.

Once the verification goes through, you should receive an email stating that "Your Google Cloud Platform billing account XXXXXX-XXXXXX-XXXXXX has been fully reinstated and is ready to use.".

GCP APIs

You will use different GCP services during the bootcamp which needs to be activated and configured.

Default APIs

Go to your project APIs dashboard, you can see a bunch of APIs are already enabled:

GCP APIs dashboard

Enable Compute Engine (virtual machines) API

👌 Note: Skip to the next section if you already have Compute Engine enabled

  • In the search bar, type compute and click on the Compute Engine result APIs search

  • Click on ENABLE

    APIs enable
  • Compute Engine is now enabled on your project

Virtual Machine (VM)

Note: The VM setup requires a Google Cloud Platform account associated with an active Billing account

ℹ️ In the guide, left click to drag the screenshots if necessary

ℹ️ You may adjust the aspect ratio of your browser window to see the full screenshots

scribe gcp vm

👌 Follow this guide or skip to the next section if you already have a VM set up

Visual Studio Code

Installation

Let's install Visual Studio Code text editor.

VS Code installation options

When the installation is finished, launch VS Code.

VS Code Remote SSH Extension

We need to connect VS Code to a virtual machine in the cloud so you will only work on that machine during the bootcamp. A pretty useful Remote SSH Extension is available on the VS Code Marketplace.

  • Open VS Code > Open the command palette > Type Extensions: Install Extensions

VSCode extensions - Search - Remote

  • Install the extension

VS Code extensions - Remote - Details

That's the only extension you should install on your local machine, we will install additional VS Code extensions on your virtual machine.

Virtual Machine connection

  • Open VS Code > Open the command palette > Type Remote-SSH: Connect to Host...

vscode-connect-to-host

  • Click on Add a new host
  • Type ssh -i <path/to/your/private/key> <username>@<ip address>, for instance, my username is somedude, my private SSH key is located at ~/.ssh/id_rsa on my local computer, my VM has a public IP of 34.77.50.76: I'll type ssh -i ~/.ssh/id_rsa somedude@34.77.50.76

vscode-ssh-connection-command

  • When prompted to Select SSH configuration file to update, pick the one in your home directory, under the .ssh folder, ~/.ssh/config basically. Usually VS Code will pick automatically the best option, so their default should work.

vscode-add-host-ssh-config

  • You should get a pop-up on the bottom right notifying you the host has been added

vscode-host-added

  • Open again the command palette > Type Remote-SSH: Connect to Host... > Pick your VM IP address

vscode-add-new-host

  • The first time, VSCode might ask you for a security permission like below, say yes / continue.

vscode-remote-connection-confirm

  • Open again the command palette > Type Terminal: Create New Terminal (in active workspace) > You now have a Bash terminal in your virtual machine!

vscode-command-palette-new-terminal


vscode-terminal

  • Still on your local computer, lets create a more readable version of your machine to connect to!
code ~/.ssh/config

You should see something like the following:

Host <machine ip>
  HostName <machine ip>
  IdentityFile <file path for your ssh key>
  User <username>

You can now change Host to whatever you would like to see as the name of your connection or in terminal with ssh <Host>!

❗️ It is important that the Host alias does not contain any whitespaces ❗️

# For instance
Host "ds-bootcamp-vm"
  HostName 34.77.50.76 # replace with your VM's public IP address
  IdentityFile <file path for your ssh key>
  User <username>

The setup of your local machine is over. All following commands will be run from within your 🚨 virtual machine🚨 terminal (via VS code for instance)

VS Code Extensions

Installation

Let's install some useful extensions to VS Code.

code --install-extension ms-vscode.sublime-keybindings
code --install-extension emmanuelbeziat.vscode-great-icons
code --install-extension MS-vsliveshare.vsliveshare
code --install-extension ms-python.python
code --install-extension KevinRose.vsc-python-indent
code --install-extension ms-python.vscode-pylance
code --install-extension ms-toolsai.jupyter
code --install-extension alexcvzz.vscode-sqlite

Here is a list of the extensions you are installing:

VS Code AI Features

VS Code includes many powerful AI features, which are a great tool once you already know how to code.

That said, relying on AI too early can hide important concepts and make debugging harder to understand. Once you’re comfortable with the fundamentals, you’ll know when and how to use AI effectively — without letting it do the thinking for you.

For the start of the bootcamp, we’ll disable these features. At the right point in the course, we’ll reenable them so you can put them to good use.

In VS Code:

  1. Let's open the VS Code "Command Palette": type Ctrl-Shift-P.
  2. This will open the Command Palette: a small text box at the top of your screen. Start typing aifeatures until you see "Chat: Learn How to Hide AI features". Click on it. The Command Palette at the top of the screen
  3. This will open the settings, and will show you the option "Disable and hide built-in AI features ...". Tick the checkbox in front of that option. Check the disable option

Later, if you want to reenable the AI features, you can follow the same instructions to untick the checkbox.

Command line tools

Check the locale

The locale is a mechanism allowing to customize programs to your language and country.

Let's verify that the default locale is set to English, please type this in the Ubuntu terminal:

locale

If the output does not contain LANG=en_US.UTF-8, run the following command in a Ubuntu terminal to install the english locale:

sudo locale-gen en_US.UTF-8

If after, you receive a warning (bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf-8)) in your terminal, please do the following:

Generate locale

Please, run this lines in your terminal.

sudo update-locale LANG=en_US.UTF8
sudo apt-get update
sudo apt-get install language-pack-en language-pack-en-base manpages

Zsh & Git

Instead of using the default bash shell, we will use zsh.

We will also use git, a command line software used for version control.

Let's install them, along with other useful tools:

  • Open an Ubuntu terminal
  • Copy and paste the following commands:
sudo apt update
sudo apt install -y curl git imagemagick jq unzip vim zsh tree direnv

These commands will ask for your password: type it in.

⚠️ When you type your password, nothing will show up on the screen, that's normal. This is a security feature to mask not only your password as a whole but also its length. Just type in your password and when you're done, press Enter.

GitHub CLI installation

Let's now install GitHub official CLI (Command Line Interface). It's a software used to interact with your GitHub account via the command line.

In your terminal, copy-paste the following commands and type in your password if asked:

sudo apt remove -y gitsome # gh command can conflict with gitsome if already installed
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install -y gh

To check that gh has been successfully installed on your machine, you can run:

gh --version

✔️ If you see gh version X.Y.Z (YYYY-MM-DD), you're good to go 👍

❌ Otherwise, please contact a teacher

Oh-my-zsh

Let's install the zsh plugin Oh My Zsh.

In a terminal execute the following command:

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

If asked "Do you want to change your default shell to zsh?", press Y

At the end your terminal should look like this:

Ubuntu terminal with OhMyZsh

✔️ If it does, you can continue 👍

❌ Otherwise, please ask for a teacher

GitHub CLI

CLI is the acronym of Command-line Interface.

In this section, we will use GitHub CLI to interact with GitHub directly from the terminal.

It should already be installed on your computer from the previous commands.

We will use the GitHub CLI (gh) to connect to GitHub using SSH, a protocol to log in using SSH keys instead of the well known username/password pair.

First in order to login, copy-paste the following command in your terminal:

⚠️ DO NOT edit the email — Even though user:email looks like a placeholder for your actual email address, it isn't — do not replace it.

gh auth login -s 'user:email' -w --git-protocol ssh

gh will ask you few questions:

  • Generate a new SSH key to add to your GitHub account? Press Enter to ask gh to generate the SSH keys for you.

    If you already have SSH keys, you will see instead Upload your SSH public key to your GitHub account? With the arrows, select your public key file path and press Enter.

  • Enter a passphrase for your new SSH key (Optional):

    • FOR MOST PEOPLE: Just press Enter to skip. You don't need a passphrase for the bootcamp and it would prompt you every time you use the key. There is a risk, however, that if someone steals your laptop, they could then push to GitHub.
    • IF SECURITY IS REALLY IMPORTANT TO YOU: Enter a passphrase of your choice and press Enter. It's really important that if you enter a passphrase, you write it down somewhere immediately and do not lose/forget it. You will need to enter this frequently.
  • Title for your SSH key. You can leave it at the proposed "GitHub CLI", press Enter.

You will then get the following output:

! First copy your one-time code: 0EF9-D015
- Press Enter to open github.com in your browser...

Select and copy the code (0EF9-D015 in the example), then press Enter.

Your browser will open and ask you to authorize GitHub CLI to use your GitHub account. Accept and wait a bit.

Come back to the terminal, press Enter again, and that's it.

To check that you are properly connected, type:

gh auth status

✔️ If you get Logged in to github.com as <YOUR USERNAME> , then all good 👍

❌ If not, contact a teacher.

Google Cloud CLI

Install the gcloud CLI to communicate with Google Cloud Platform through your terminal:

sudo apt-get update && sudo apt-get install ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-cli

👉 Install documentation

Create a service account key 🔑

👌 Note: Skip to the next section if you already have a service account key

Now that you have created a GCP account and a project (identified by its PROJECT_ID), we are going to configure the actions (API calls) that you want to allow your code to perform.

🤔 Why do we need a service account key ?

You have created a GCP account linked to your credit card. Your account will be billed according to your usage of the ressources of the Google Cloud Platform. The billing will occur if you consume anything once the free trial is over, or if you exceed the amount of spending allowed during the free trial.

In your GCP account, you have created a single GCP project, identified by its PROJECT_ID. The GCP projects allow you to organize and monitor more precisely how you consume the GCP ressources. For the purpose of the bootcamp, we are only going to create a single project.

Now, we need a way to tell which ressources within a GCP project our code will be allowed to consume. Our code consumes GCP ressources through API calls.

Since API calls are not free, it is important to define with caution how our code will be allowed to use them. During the bootcamp this will not be an issue and we are going to allow our code to use all the API of GCP without any restrictions.

In the same way that there may be several projects associated with a GCP account, a project may be composed of several services (any bundle of code, whatever its form factor, that requires the usage of GCP API calls in order to fulfill its purpose).

GCP requires that the services of the projects using API calls are registered on the platform and their credentials configured through the access granted to a service account.

For the moment we will only need to use a single service and will create the corresponding service account.

Since the service account is what identifies your application (and therefore your GCP billing account and ultimately your credit card), you are going to want to be cautious with the next steps.

⚠️ Do not share you service account json file 🔑 ⚠️ Do not store it on your desktop, do not store it in your git codebase (even if your git repository is private), do not let it by the coffee machine, do not send it as a tweet.

  • Go to the service accounts page
  • Select your project in the list of recent projects if asked to
  • Create a service account:
    • Click on CREATE SERVICE ACCOUNT:
    • Give a Service account name to that account
    • Click on CREATE AND CONTINUE
    • Click on Select a role and choose Quick access/Basic then Owner, which gives full access to all ressources
    • Click on CONTINUE
    • Click on DONE
  • Download the service account json file 🔑:
    • Click on the newly created service account
    • Click on KEYS
    • Click on ADD KEY then Create new key
    • Select JSON and click on CREATE

The browser has now saved the service account json file 🔑 in your downloads directory (it is named according to your service account name, something like le-wagon-data-123456789abc.json)

Configure Cloud sdk

  • Open the service account json file with any text editor and copy the key

    # It looks like:
    {
        "type": "service_account",
        "project_id": "kevin-bootcamp",
        "private_key_id": "1234567890",
        "private_key": "-----BEGIN PRIVATE KEY-----\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n-----END PRIVATE KEY-----\n",
        "client_email": "bootcamp@kevin-bootcamp.iam.gserviceaccount.com",
        "client_id": "1234567890",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/bootcamp%40kevin-bootcamp.iam.gserviceaccount.com"
    }
    
  • on your Virtual Machine, create a ~/.gcp_keys directory, then create a json file in it:

    mkdir ~/.gcp_keys
    touch ~/.gcp_keys/le-wagon-de-bootcamp.json
  • Open the json file then store the service account json file pasting the key:

    code ~/.gcp_keys/le-wagon-de-bootcamp.json

    service account json key

    ❗️Don't forget to save the file with CMD + s or CTRL + s

  • Authenticate the gcloud CLI with the google account you used for GCP

    # Replace service_account_name@project_id.iam.gserviceaccount.com with your own
    SERVICE_ACCOUNT_EMAIL=service_account_name@project_id.iam.gserviceaccount.com
    KEY_FILE=$HOME/.gcp_keys/le-wagon-de-bootcamp.json
    gcloud auth activate-service-account $SERVICE_ACCOUNT_EMAIL --key-file=$KEY_FILE
  • List your active account and check your email address you used for GCP is present

    gcloud auth list
  • Set your current project

    # Replace `PROJECT_ID` with the `ID` of your project, e.g. `wagon-bootcamp-123456`
    gcloud config set project PROJECT_ID
  • List your active account and current project and check your project is present

    gcloud config list

Dotfiles

Let's enhance the experience of your machine by installing Le Wagon's pre-configured dotfiles 🔗. These are configuration files for your terminal, zsh, git, and VS Code.

Get your GitHub username

Run the following command:

export GITHUB_USERNAME=`gh api user | jq -r '.login'`
echo $GITHUB_USERNAME

✔️ You should see your Github username printed.

❌ If not, stop here and ask for help. There may be a problem with the previous step (gh auth).

Forking the dotfiles

To customise this configuration for yourself, you'll need to fork the repository to your own Github account.

Forking creates a copy of the repository under your account (your_github_username/dotfiles), which you can then modify with your personal information, such as your name.

❗ If you already did another Le Wagon bootcamp (Web Development, AI Software Development, Data Analytics, Data Science & AI, open a ticket with a TA and open this for instructions ❗

You may have an older version of the Le Wagon dotfiles. They could be incompatible with the current setup.

Together with a TA, do one of the following:

I'm using the same machine (or a new machine which already has the dotfiles).
  1. Move into your existing dotfiles folder:

    cd ~/code/$GITHUB_USERNAME/dotfiles
  2. Check the diff against the current version of Le Wagon's dotfiles:

    git diff upstream/master

If there is no meaningful difference other than your name and email setting, continue with the setup.

I'm using a new machine without the dotfiles.
  1. Browse to GitHub and find your dotfiles repository.

  2. Check how many commits it's behind and ahead lewagon/dotfiles:master. You can see this just above the file list.

  3. Click through to the behind and the ahead, and scroll down to see the diffs.

If there is no meaningful difference other than your name and email setting, continue with the setup.

The previous step revealed meaningful differences.

If you are OK with losing your existing dotfiles (recommended):

Be aware that this will remove any personal changes you made to your shell configuration, like loading extra utilites, or changing the look and feel of your shell. If you're not aware of any changes you made yourself, this should be fine.

  1. Delete your existing dotfiles repository on GitHub.
  2. Delete the local repository:
    cd ~/code && rm -rf ~/code/$GITHUB_USERNAME/dotfiles
  3. Continue with the setup.
If you do not want to lose your existing dotfiles, we recommend working with branches. Click to open.

On your laptop, or wherever you have a local copy of your existing version of dotfiles.

  1. Commit your current version of your dotfiles:

    git add .
    git status # Check what will be committed
    git commit -m "Version prior to new setup"
  2. Create a branch of your current dotfiles setup, and push to GitHub:

    git checkout -b old-setup
    git push origin old-setup
  3. Go back to master: git checkout master.

  4. On local master, git pull upstream master.

  5. Check that you're not in MERGING state. If you are, resolve any conflicts.

    It is important that you accept incoming changes to the .zshrc, .zprofile, and settings.json files. Especially anything related to pyenv and to Python environments.

    If there are too many conficts, use your code editor to replace the contents of the conflicting files with the ones from the Le Wagon dotfiles.

    Commit your conflict resolution: git commit --no-edit

  6. Push your changes to GitHub: git push origin master.

  7. Continue with the setup.


Time to fork the repo and clone it on your computer:

mkdir -p ~/code/$GITHUB_USERNAME && cd $_
gh repo fork lewagon/dotfiles --clone

If you're asked "Are you sure you want to continue connecting (yes/no/[fingerprint])?", type yes followed by Enter.

Installing the dotfiles

Run the dotfiles installer with:

cd ~/code/$GITHUB_USERNAME/dotfiles && zsh install.sh

Check the emails registered with your GitHub Account. You'll need to pick one in the next step:

gh api user/emails | jq -r '.[].email'

Run the git installer:

cd ~/code/$GITHUB_USERNAME/dotfiles && zsh git_setup.sh

☝️ This will prompt you for your name (FirstName LastName) and your email.

⚠️ You need to put one of the emails listed above from the previous gh api ... command. If you don't do that, Kitt will not be able to track your progress.

💡 Select the ...@users.noreply.github.com address if you don't want your email to appear in public repositories you may contribute to.

zsh default terminal

Set zsh as your default VS Code terminal.

  • Open terminal default profile settings

    Terminal profile settings
  • Select zsh /usr/bin/zsh

    Terminal zsh profile

Disable SSH passphrase prompt

You don't want to be asked for your passphrase every time you communicate with a distant repository. So, you need to add the plugin ssh-agent to oh my zsh:

First, open the .zshrc file:

code ~/.zshrc

Then:

  • Spot the line starting with plugins=
  • Add ssh-agent at the end of the plugins list

✔️ Save the .zshrc file with Ctrl + S and close your text editor.

Install pyenv

Ubuntu comes with an outdated version of Python that we don't want to use. You might already have installed Anaconda or something else to tinker with Python and Data Science packages. All of this does not really matter as we are going to do a professional setup of Python where you'll be able to switch which version you want to use whenever you type python in the terminal.

First let's install pyenv with the following Terminal command:

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
exec zsh

Let's install some dependencies needed to build Python from pyenv:

sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev sqlite3 libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
python3-dev

Install Python

Let's install the latest stable version of Python supported by Le Wagon's curriculum:

pyenv install 3.12.9

This command might take a while, this is perfectly normal. Don't hesitate to help other students seated next to you!

🛠 Troubleshooting `pyenv` not found

If you encounter an error Command 'pyenv' not found: execute the following line:

source ~/.zprofile

Then try to install Python again:

pyenv install 3.12.9

If pyenv is still not found, contact a teacher.


OK once this command is complete, we are going to tell the system to use this version of Python by default. This is done with:

pyenv global 3.12.9
exec zsh

To check if this worked, run python --version. If you see 3.12.9, perfect! If not, ask a TA that will help you debug the problem thanks to pyenv versions and type -a python (python should be using the .pyenv/shims version first).

Python Virtual Environment

Before we start installing relevant Python packages, we will isolate the setup for the Bootcamp into a dedicated virtual environment. We will use a pyenv plugin called pyenv-virtualenv.

Setup a virtualenv

First let's install this plugin:

git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
exec zsh

Let's create the virtual environment we are going to use during the whole bootcamp:

pyenv virtualenv 3.12.9 lewagon

Let's now set the virtual environment with:

pyenv global lewagon

Great! Anytime we'll install Python package, we'll do it in that environment.

Python packages

Now that we have a pristine lewagon virtual environment, it's time to install some packages in it.

First, let's upgrade pip, the tool to install Python Packages from pypi.org. In the latest terminal where the virtualenv lewagon is activated, run:

pip install --upgrade pip

Then let's install some packages for the first weeks of the program:

pip install -r https://raw.githubusercontent.com/lewagon/data-setup/master/specs/releases/linux.txt

Jupyter Notebook tweaking

Depending on your system, we need to make some small changes to your Jupyter configuration.

Run this:

bash -c "$(curl -s https://raw.githubusercontent.com/lewagon/data-setup/refs/heads/master/checks/setup_jupyter.sh)"
If you are curious about what happens here, click here.

This script adds a configuration to improve the display of the details disclosure elements in your notebooks.

If you're using Windows WSL, it also fixes some other problems.

Python setup check

Let's run some checks. If any of the following steps fail, ask a TA for help.

Let's reset your terminal:

cd ~/code && exec zsh

Make sure you can run Jupyter:

jupyter notebook

Your web browser should open on a jupyter window.

Note if you're running the setup on a virtual machine

VSCode detects that a jupyter notebook started in your virtual machine and creates a port forward in order to allow you to open the application in your browser.

Hit Open in Browser or go to http://localhost:8888/ (the url to use is available in the terminal).

On the first run, jupyter will ask for the token displayed in the terminal of your virtual machine in order to allow you to connect to the application from your local machine.

Fill the token and hit Log in.

You are now interacting from your local machine with the jupyter application running in your virtual machine.

jupyter.png

Click on New and in the dropdown menu select Python 3 (ipykernel):

jupyter_new.png

A tab should open on a new notebook:

jupyter_notebook.png

Make sure that you are running the correct python version in the notebook. Open a cell and run:

import sys; sys.version

It should output 3.12.9 followed by some more details. If not, check with a TA.

In another cell, run:

import pandas as pd
pd.__version__

This might take a few minutes to run. It should output a version number, 2.2.3. If not, check with a TA.

You can close your web browser then terminate the jupyter server with CTRL + C.

Here you have it! A complete python virtual env with all the third-party packages you'll need for the whole bootcamp.

Docker 🐋

Docker is an open platform for developing, shipping, and running applications.

if you already have Docker installed on your machine please update with the latest version

Install Docker

Go to Docker install documentation.

Then follow the tutorial instructions to install Docker using the repository. There are 2 steps:

  1. Set up Docker's apt repository.
  2. Install the Docker packages.

Now, let's make sure we can run docker without sudo.

Run the following commands one by one:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
sudo rm -rf ~/.docker/

When finished, run the following command:

docker run hello-world

The following message should print:

Kitt

You should have received an email from Le Wagon inviting you to sign up on Kitt (our learning platform).

Then you should receive an additional invitation from Slack, inviting you to the Le Wagon Alumni slack community (where you'll chat with your buddies and all the previous alumni). Click on Join and complete the information.

If you haven't, please contact your teaching team.

Slack

Slack is a communication platform pretty popular in the tech industry.

Installation

Download the Slack app and install it.

⚠️ If you are already using Slack in your browser, please download and install the desktop app which is fully featured.

Settings

Launch the app and sign in to lewagon-alumni organization.

Make sure you upload a profile picture 👇

How to upload a profile picture on Slack

The idea is that you'll have Slack open all day, so that you can share useful links / ask for help / decide where to go to lunch / etc.

To ensure that everything is working fine for video calls, let's test your camera and microphone:

  • Open the Slack app
  • Click your profile picture in the top right.
  • Select Preferences from the menu.
  • Click Audio & video in the left-side column.
  • Below Troubleshooting, click Run an audio, video and screensharing test. The test will open in a new window.
  • Check that your preferred speaker, microphone and camera devices appear in the drop-down menus, then click Start test.

Check microphone and webcam with Slack

✔️ When the test is finished, you should see green "Succeed" messages at least for your microphone and camera. 👍

❌ If not, contact a teacher.

You can also install Slack app on your phone and sign in lewagon-alumni!

(Bonus) Kata

If you are done with your setup, please ask around if some classmates need some help with theirs (macOS, Linux, Windows). We will have our first lectures at 2pm and will talk about the Setup you just did + onboard you on Kitt.

If you don't have a lot of experience with git and GitHub, please (re-)watch this workshop (1.25 playback speed is fine).

If you do, then you can wait for the first lecture working on this Tic-Tac-Toe Kata