Skip to content
Learn Netverks

Lesson

Step 23/36 64% through track

pip-basics

pip basics

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches pip basics: the syntax, patterns, and safety habits you need before advancing in Python.

Virtual environments isolate dependencies—production deploys pin versions in requirements.txt or poetry.lock.

You will apply pip basics in contexts like: Scripts, Django/FastAPI apps, notebooks, and glue code between systems.

Write Python 3 in the editor and click Run on server—the dev runner executes your script with print() for output; stdlib only in playground snippets (LEARNING_RUNNER_ENABLED=true).

When you can explain the previous lesson's ideas without copying starter code.

pip installs packages from PyPI into the active Python environment. Pin versions in requirements.txt or pyproject.toml for reproducible builds—like NuGet in C# or npm for Node.

Common commands (local)

pip install requests
pip install "django>=4.2,<5"
pip freeze > requirements.txt
pip install -r requirements.txt

Playground vs local

Third-party packages (Django, requests, pandas) are not available in the sandbox—simulate patterns with stdlib here, then install locally. Django lessons start in the Django track.

Important interview questions and answers

  1. Q: pip vs conda?
    A: pip is Python's default package installer from PyPI; conda manages binaries and non-Python deps in Anaconda ecosystems.
  2. Q: Why pin versions?
    A: Prevents surprise breaking upgrades in CI and production—reproducible installs.

Self-check

  1. What file lists pinned dependencies?
  2. Can you pip install Django in the playground?

Pitfall: Pin versions in CI—pip install django without constraints can pull breaking updates.

Interview prep

pip freeze purpose?

Capture installed versions into requirements.txt for reproducible installs.

Playground pip packages?

Third-party packages need local pip—sandbox runs stdlib-only scripts.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • pip freeze?
  • requirements.txt?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump