Skip to content
BENIBIX Learn

Package Managers, npm and pip

Level 4 · Other people's code

What a package is, where it lives, and how a package manager fetches it. How npm does it for JavaScript and pip for Python.

Course contentsLesson 8 of 13

After this lesson you can

  • Say what a package and a registry are
  • Install a package with npm or pip
  • Check a package before you trust it

12 mincovers 5 glossary entries

Worth reading first: Libraries, Frameworks and SDKs

How a package gets from the shelf into your project

A package is shared code with a name and a version number. A package registry is the website that stores packages, and Python's main one alone holds more than 900,000 projects. A package manager is the tool that fetches them. You type one command with a name, and it downloads that package and each package it needs.

Most packages hold a library, and some hold a tool you run. Each one also carries a list of the other packages it needs. That list is why one install can bring in fifty packages: each one asks for its own.

Each language has its main registry. JavaScript has the npm registry, which holds millions of packages. Python has the Python Package Index, called PyPI for short. Big firms also run their own private ones for their own code.

npm is the package manager for JavaScript, and it comes with Node.js. Type npm install and a name, and it fetches that package from the npm registry. A file in the project lists what it needs. So a teammate can type npm install and get the same set.

pip is the standard package manager for Python, and it comes with Python. The command pip install and a name fetches a package from PyPI. Like npm, it brings in whatever that package needs. Python projects keep their own list of needed packages, so anyone can install the same set.

A package manager also writes down exactly what it installed. That record, the lockfile, is what lets a second computer get the same versions. It belongs in Git with the rest of your code.

Anyone can put a package on a public registry, and that is the danger. Some people post fake packages with names one letter off from real ones. They hope you make a typo. Check the spelling, the author and how many people use a package before you install it.

console
$ npm install lodash

added 1 package, and audited 2 packages in 668ms

found 0 vulnerabilities
$ pip install requests
Successfully installed certifi-2026.10.23 charset_normalizer-3.5.2 idna-3.20 requests-2.34.2 urllib3-2.8.0
npm fetches one package. pip fetches one, plus the four it needs, which is why five names come back.
The registry is the shelf. The package manager fetches from it and writes down exactly what it took.

Worked example

Jack almost installs the wrong package

Jack types pip install reqeusts, with two letters swapped. He stops before pressing Enter and looks the name up on PyPI.

The real requests package is used by millions of projects. The misspelled name has no known author, so he types the real one.

The words for this lesson5

Check yourself

Is a package safe because it is on npm or PyPI?

Finished this lesson?

Marking it complete also marks its 5 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.