Python-Series-00 : Set up and test your working environment

17 July 2025, 15:47:41

1. Set up your working environment on your laptop¶

Please follow the instructions in Python minimal install step by step and come back here when you are done.

2. Test your working environment¶

To test your python environment, you will create a new data analysis project and run a Jupyter notebook.

  1. Download the Python-for-HMS-Template
  2. Expand the zip file and rename the extracted folder to Python-Series-00.
  3. Move the folder to the right place on your computer.

    • NOTE: what is the right place? Likely the folder where you store your data analysis projects for this course.
      e.g., On windows and Mac computers, you can create a folder Courses in your Documents folder and then a subfolder IEAP and then a subfolder Python.
    • ADVICES:
      • do not use a name including spaces or special characters (e.g. Series 00 or Series00!). Reason: it will make your life more difficult when you will use the command line.
  4. Launch VScode

    • open the folder Python-Series-00 in a new window
    • Open the file main.ipynb
    • Run the notebook main.ipynb by clicking the Run all button .
  5. You should get the following output:

main.ipynb.png

2.1.Troubleshooting¶

This is where things get complicated, because the problem is specific to YOUR computer...

But here are some general advices:

  • carefully read the error message. It will give you a hint about the problem.
  • Google the error message and try to find a solution on the web.
  • Discuss the problem with your colleagues.
  • In a last resort, ask your teacher for help :-)

3. Get information about your working environment¶

  1. Create a new Jupyter notebook that you save as Configuration.ipynb
  2. In this notebook, create a new cell of python code
  3. In this cell, write the following code:

    import sys 
     import os
     import platform
    
     # manually enter your information here
     lastName = "YOUR_FAMILY_NAME" # replace with your family name
     firstName = "Your_Given_Name" # replace with your given name
     operatingSystem = "Your_Operating_System" # replace with your operating system
     duration = 1.5 # replace with the duration it took you to complete this assignment
    
     # print the manually entered information
     print("Name:", firstName, lastName)
     print("Operating System:", operatingSystem)
     print("Duration:", duration, "hours")
    
     # print the operating system information
     print("platform:", platform.platform())
     print("system:",   platform.system())
     print("machine:",  platform.machine())
     print("processor:", platform.processor())
     print("node:",     platform.node())
     print("  Mac :",  platform.mac_ver())
     print("  Linux:",  platform.libc_ver())
     print("  Windows:",  platform.win32_ver())
     print("python:",  platform.python_version())
     # print python kernel information
     print("  kernel: ",  sys.executable)
     print("  python", sys.version)
     # print current working directory
     print("cwd:",     os.getcwd())
    
  4. Save the notebook and run it.

NB : the output of the code should look like below:

Name: Denis MOTTET
Operating System: OSX Sonoma
Duration: 1.5 hours
platform: macOS-15.5-arm64-arm-64bit
system: Darwin
machine: arm64
processor: arm
node: MacBook-Pro-de-Denis.local
  Mac : ('15.5', ('', '', ''), 'arm64')
  Linux: ('', '')
  Windows: ('', '', '', '')
python: 3.10.13
  kernel:  /Users/denismottet/miniconda3/envs/m2-2024/bin/python
  python 3.10.13 | packaged by conda-forge | (main, Oct 26 2023, 18:09:17) [Clang 16.0.6 ]

Bravo! You are done with the first assignment.¶

Your environment is ready for the first class.