npm and pip are app stores for code libraries.
When a guide says <code>npm install whisper</code> or <code>pip install openai</code>, it's doing the same thing as "Get" on the App Store — downloading a piece of code someone else wrote so you don't have to. npm is for JavaScript projects. pip is for Python. That's the whole difference.
The first time I followed an AI guide, the second line was pip install openai. I typed it. It worked. I had no idea what had just happened. I assumed "pip" was some kind of magic.
It's not magic. It's a package manager — a command-line app store. The same mental model you use for the App Store or the Play Store applies here: someone built a thing, uploaded it to a central library, and now you can install it with one command. No downloading .dmg files. No dragging to Applications. Just one line.
There are two you'll see constantly on this site: npm (for JavaScript/Node.js projects) and pip (for Python projects). This article explains both in about five minutes. After this, every install command will make sense immediately.
// 01What a package manager actually does
A package is a bundle of code someone else wrote and published. A package manager is the tool that downloads and installs those bundles for you. It also keeps track of which ones you have, so you can remove or update them later.
The difference is that package managers work for code libraries — pieces of code that other programs use internally — rather than apps you open with a click. You install a library once, and then any code in your project can use it.
// 02npm vs pip — how to know which one to use
The rule is simple: follow the language. If the guide you're following is a Python project, you'll use pip. If it's a JavaScript/Node.js project, you'll use npm. The guide will make it obvious — the install command in the README tells you which one.
npm — for JavaScript / Node.js
npm stands for Node Package Manager. It ships with Node.js, so if you install Node.js you automatically have npm too. Almost all web-based AI tools, Next.js apps, and browser-extension projects use npm.
pip — for Python
pip is Python's package manager. It comes bundled with Python 3. Most AI/ML tools — Whisper, LangChain, Stable Diffusion, PyTorch — are Python packages installed with pip.
// 03The two files that describe what's installed
Every project that uses packages has one of these files. They're not code — they're manifests: lists of which packages the project needs and at what version. When someone else clones your project, they run one command and the manifest tells their package manager exactly what to install.
package.json (npm projects)
This file lives in the root of every npm project. When you see a repo with a package.json, you know: run npm install and you'll have everything. You rarely edit this by hand — npm install <package-name> adds the entry automatically.
{
"name": "my-ai-project",
"dependencies": {
"openai": "^1.3.5",
"next": "^14.0.0"
}
}requirements.txt (pip projects)
Same idea for Python. One package per line, optional version pinned. Run pip install -r requirements.txt and the whole project installs. Most AI tool repos include this file.
openai>=1.3.0 whisper==1.1.10 torch>=2.0.0 numpy
// 04How to read an install command
Every install command follows the same pattern. Once you see it, you can read any guide's install section without needing to think.
npm install openai @1.3.5 ↑ ↑ ↑ ↑ tool action package version (optional) pip install openai==1.3.5 ↑ ↑ ↑ tool action package + version
The version is optional. Without it, you get the latest stable version, which is almost always what you want. Guides only pin a version when a newer one breaks something — they'll tell you why.
npm install <package>— installs into the current project foldernpm install -g <package>— installs globally (available everywhere, not just this project). Rare — only when a guide says-g.pip install <package>— installs into the current Python environmentpip install --upgrade <package>— upgrades an existing package
// 05Now you. Run your first install command.
Five minutes. We'll check if npm and pip are already on your machine (they probably are), then install one real package each. No project needed — we're just practicing the motion.
Check your package managers and run one install
- Open a terminal. (You did this in Foundation #01. Same window.)
- Check if npm is installed: type
npm --versionand press Enter. You should see a version number like10.2.3. If you get "command not found," install Node.js from nodejs.org — npm comes with it. - Check if pip is installed: type
pip --version(orpip3 --version) and press Enter. You should see something likepip 23.3 from /usr/local/lib/python3.11. If missing, install Python from python.org. - Install a real package with pip: type
pip install httpxand press Enter. httpx is a tiny, harmless HTTP library — good practice without side effects. - Verify it installed: type
pip show httpx. You'll see the version, location, and description. That's it — you just installed a package.