✦ Python Intermediate & OOP Local Python project

L2 · Concept 05 · Modules, Packages & Environments

The code is here.
How do you run the project?

Learn to install Python libraries, manage their versions, and run an existing project in VS Code.

Learning goalDownload a Python project, install its dependencies, and run the application successfully.
01 Learn02 Run locally03 Check your understanding

Learning as a guest

Learning as a guest? Save your progress!

Create a free account to learn with Sloby AI, check your understanding, and track your progress.

The entire platform is free throughout 2026. Foundations stays free forever.

pip installs the tools a project needs.

pip installs and manages Python packages. After the virtual-environment lesson, use it inside the correct project environment.

python -m pip install rich
python -m pip list
python -m pip show rich

The first command installs a package. pip list shows installed packages, while pip show rich displays information about one package.

rich is a direct dependency because this project imports it. A package can also install transitive dependencies that it needs; their exact set can vary by version and environment.

↳

Version examples: rich==X.Y.Z means one exact version, rich>=X.Y.Z permits that or newer versions, and rich<X.Y.Z permits lower versions. These are examples, not a promise that every newer version works with older code.

The project requirements.txt
rich>=13.7,<15

A manually maintained requirements.txt can name direct dependencies and compatible versions. pip freeze records all installed distributions, including transitive dependencies, so do not overwrite a carefully prepared requirements file without understanding the difference.

Install an existing project’s dependencies
python -m pip install -r requirements.txt
python -m pip --version

Run these commands from the project folder. python -m pip --version helps you check which Python interpreter pip is connected to.

When a downloaded project does not run

  1. 1. Read the project filesOpen README.md, main.py, and requirements.txt before running commands.
  2. 2. Create or select .venvUse the Concept 04 workflow to create a local .venv and select its VS Code interpreter.
  3. 3. Install requirementsRun python -m pip install -r requirements.txt, then run python main.py.

Troubleshooting a downloaded project

  • ModuleNotFoundErrorCheck the selected interpreter, activated environment, and whether requirements were installed there.
  • requirements.txt is not foundCheck that the terminal is in the project folder.
  • A version does not workRead the error before changing versions; different versions can have different requirements and behavior.
  • vreme.json is not foundKeep podaci/vreme.json in the displayed project structure. The example uses pathlib so its path does not depend on the terminal folder.

Run My Weather Report

Do this in VS Code

Download a real small project, inspect its files, then prepare your local environment and run it.

Download Python project
My Weather Report
vremenski_izvestaj/
├── main.py
├── podaci/vreme.json
├── alati/izvestaj.py
├── requirements.txt
├── .gitignore
└── README.md

The project reads local demonstration weather data and formats a terminal table with rich. It does not call an API or use the internet.

Open and run the downloaded project

  1. Download and extract the ZIPExtract vremenski_izvestaj.zip, then open the vremenski_izvestaj folder in VS Code.
  2. Inspect the projectRead README.md, main.py, and requirements.txt. Notice that main.py imports from the alati package.
  3. Prepare dependenciesCreate/select .venv as in the previous lesson, then install the listed packages.
    python -m pip install -r requirements.txt
  4. Run the reportRun main.py and confirm that the terminal shows the three demonstration cities.
    python main.py
↳

Expected result: Novi Sad 18 °C Beograd 20 °C Subotica 17 °C These are demonstration values, not a current weather forecast.

Before asking Sloby for help

  • Check pip’s interpreterRun <code>python -m pip --version</code> and check that it points to the project environment.
  • Check the project structureDo not move vreme.json away from podaci or izvestaj.py away from alati.
↳

Level 2 complete. You now know how to organize Python code, use packages, prepare a virtual environment, and run a project with its dependencies.

You downloaded a Python project with requirements.txt but no .venv folder. What is the best next step?

Remember that a virtual environment is local, while requirements.txt records what to install.

requirements.txt
# rich>=13.7,<15
Choose the output

Build confidence independently

Get the project running

Use the downloaded project or another project folder. Diagnose the setup before asking for a direct command.

Your goalIdentify the missing dependency or setup step, check requirements.txt and the interpreter, install what the project needs, run it, and explain which step solved the problem.
projekat/
├── main.py
├── requirements.txt
└── .venv/  # local only

Work in your local VS Code folder

Progressive hints
  • Read the error and inspect requirements.txt before changing anything.
  • Check the selected interpreter and use python -m pip list.
  • If requirements are missing, run python -m pip install -r requirements.txt in the project environment.

Ask Sloby to explain an error, or use Check My Code for the active file. Sloby does not run commands, install packages, activate environments, or run the project for you.

Sloby, the Python AI Tutor mascot

Your learning mentor

Sign in to ask Sloby

Create a free account or sign in to get AI guidance while you learn.

Sign in to check your understanding

Create a free account or sign in to receive AI feedback and save your learning progress.

Python AI Tutor · Learn by understanding, not just by running code.