First, let's install and import the libraries we need. Part 1 uses gymnasium for the environment. Part 2 fine-tunes a language model, so it additionally needs HuggingFace transformers, peft, datasets ...