Warning
This page is located in archive.

Python Development

In order to work on the assignments you will need several tools:

Git

All assignments are available through the assignment template repository.

You can download a git version for your operating system at https://git-scm.com/. If you are new to git, check one of the tutorials, Pro Git book or https://try.github.io/.

Make sure to get the current template version before starting to work on an assignment! Keep in mind that the assignments and the assignment templates will be updated during the semester. Always use git pull to have the current template version before starting to work on the assignment!

Make sure not to push the repository with your solutions to any public remote (=plagiarism!!!), you can use FEE GitLab for private remote repo.

Python

The programing language of the course is Python. You can either use an environment manager such as Conda to automatically download Python alongside all required packages (works on Linux, Windows and MacOS), or you can install the packages manually using Python's native package manager pip.


Conda
  1. Install Anaconda to your PC. You can download it from https://www.anaconda.com/download/
  2. Create a new Conda environment called rpz (all packages are installed just inside the Conda environment, not to interfere with other packages/Python version that might exist on your PC)
    conda create --name rpz python=3.10
  3. Activate the environment
    conda activate rpz
  4. Install the following packages into the environment
    conda install numpy=1.24 matplotlib=3.7 jupyter ipywidgets scipy pyyaml=6.0
    conda install pytorch==1.12.1 torchvision==0.13.1 cpuonly -c pytorch
  5. Test everything is installed properly
    python -c "import numpy as np; print(np.ones(4))"
    Expected output
    [1. 1. 1. 1.]

PIP
  1. Install Python to your PC. The version used by the upload system - BRUTE is 3.10, we strongly recommend to use the same version. You can download Python from https://www.python.org/downloads/
  2. (Recommended) It is a good practice to to setup a virtual environment such as virtualenv to keep the installed Python packages separate. This is especially useful when you work on several Python projects at the same time during the semester and each one has different package versions.
  3. Install the following packages using pip
    pip install numpy==1.24 matplotlib==3.7 jupyter ipywidgets scipy pyyaml==6.0
    pip install torch==1.12.1+cpu torchvision==0.13.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
  4. Test everything is installed properly
    python -c "import numpy as np; print(np.ones(4))"
    Expected output
    [1. 1. 1. 1.]

IDE

We develop and test the lab code in various editors and the code should be working with any of them. All code is tested to work in VSCode, but should work with others as well. Feel free to use your favorite one if you know how to setup it for the course.

If you are new to Python development, we recommend VSCode or PyCharm (CTU has free student licenses). In case you need help with other IDE, we also have experience also with Emacs, or neovim. Feel free to contact us at the forum if you need some help.

Jupyter notebooks

All assignments are contained in Jupyter notebooks. Although you may opt for not using it and still be able to finish the course, they are a convenient way to have the explanation, tests and basic lab structure at one place.

To be able to open them in VSCode, you will need to install Python extension and Jupyter Notebook Renderers extension.

courses/be5b33rpz/labs/python_development.txt · Last modified: 2023/09/26 15:49 by sochmjan