Getting started

How to get setup:

  1. Install Python

  2. Install Git

  3. Install libraries

  4. Install a text editor

github account?


Notes

The term 'Terminal' refers to a text prompt to enter commands, to open it:

Windows: Either: press the windows key, type cmd and press enter. Or open file explorer click on the file path, type cmd and press enter to open a terminal in the directory file explorer was in.

Mac: idk, someone who uses mac put instructions here.

Many of the commands you will need to enter begin with python, you may have to use py (windows) or python3 instead.


Currently Mac's with apple silicon (M1) are not supported (TODO: check this)

Installing Git

If you do not already have git installed... – you can check by running git --version in your terminal

Windows: Visit the git website here

macOS: There is a version of git ~built into macOS. It gets installed as a prerequisite for Homebrew. However, you can get a more up-to-date version from Homebrew too: brew install git

Linux: Install git using your package manager.

Installing Python

We recommend installing the latest version of Python (3.10 at the time of writing), however any version from 3.8 onwards will work with RobotPy (the set of Python libraries used to program robots in FRC).

Windows

Before continuing, it is recommended you check whether you already have Python installed.

  1. Open a Command Prompt, Windows Terminal, or PowerShell window – from here on this will be referred simply as the terminal.

  2. Type python --version – this should either tell you Python is not installed from the Microsoft Store, or tell you what version of Python you have.

  3. Type py -0 – this will either error, or tell you what versions of Python you have installed via other means.

From the Microsoft Store

This is probably the easiest way to get started with Python on Windows.

  1. Run python in your terminal to go to the Microsoft Store page.

  2. Press install.

This will provide both a python and python3 command. However, it does not install a py command.

From Python.org

  1. Visit Python.org.

  2. Download and install the latest version of Python.

Note that there are a few subtle differences with the Python.org installer:

  • By default you do not get a python command. This can be changed by checking the "Add to PATH" option when installing.

  • You will not get a python3 command.

  • The "Python Launcher for Windows" will be installed as the py command.

    • This can be used as an alternative to the "Add to PATH" option, which can have unintended side-effects (however these are minor).

macOS

Built-in

Newer versions of macOS ship with a version of Python 3 built into the OS. This will be outdated, however it is likely new enough for FRC, assuming you keep the OS up-to-date.

macOS 11 (Big Sur) shipped with Python 3.8.

Homebrew

Homebrew is a popular package manager for macOS.

If you do not already have Homebrew installed:

  1. Open the Terminal app.

  2. Visit https://brew.sh in your browser and follow the instructions provided.

  3. Run brew upgrade on a regular basis to keep everything up-to-date.

To install Python using Homebrew:

  1. Run brew install python in your terminal.

You should now have python and python3 commands available and up-to-date.

From Python.org

This is not recommended by the macOS users on the team, however it is an option. This method of installation makes it difficult to uninstall later, which means it is difficult to update.

Linux

Please install python3 from your package manager. If you require more instruction here, please contact Davo to add instructions for your distro.

Installing Python Libraries

Create a virtual environment (Optional)

It is recommended (i.e. optional if this looks too hard) to install RobotPy into a virtualenv (venv), this will install the libraries for just that project and not globally. This will make it easier to install the next year's version and blow everything away without interfering with any other libraries you may install.

To create a virtualenv named .venv:

python -m venv .venv

To activate a virtualenv (so that all python commands use the virtualenv in your current terminal):

Windows Command Prompt:

.venv\bin\activate.bat

Linux/macOS:

. .venv/bin/activate

You can read more information about virtual environments here: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/

Install libraries:

First ensure that:

Windows: Visual Studio 2019 redistributable is installed

Linux: Pip version >= 20.3

Mac: Not on M1

Then if you are working on an existing, project do:

python -m pip install -r requirements-sim.txt

Otherwise do:

python -m pip install robotpy[all]


This information is also available here: https://robotpy.readthedocs.io/en/stable/install/computer.html

Text editor setup

Any text editor will work but it should probably have: syntax highlighting (coloured text), linting (automatically flag errors) and autocomplete. Many people on the team use Visual Studio Code which can be downloaded here.

  • There is a recommended extension that adds linting which you should install.