Versions, Isolation, and Reading Errors
✦ Why projects need isolated dependencies
Two projects on one machine will eventually need different versions of the same library. If everything is installed globally, one of them breaks. The fix in Python is a virtual environment, a directory holding that project's own packages, created with python3 -m venv .venv and switched on with source .venv/bin/activate. In JavaScript, node_modules already sits inside the project, so isolation is the default.
Recording what a project needs. An installed package is no use if the next person cannot reproduce it.
Python writes pip3 freeze > requirements.txt and installs with pip3 install -r requirements.txt.
JavaScript records dependencies in package.json automatically, and npm install with no arguments installs everything listed there.
This is why cloning a project and running one install command usually works. Somebody recorded the requirements.
Reading an error properly. When something fails, the error is usually telling you exactly what is wrong, and the instinct to skim it is the enemy.
`
zsh: command not found: python
`
That is not a mystery. It says a program by that name is not on PATH. So you check: which python, then which python3, and discover the name is different on your machine. The routine is always the same: read the whole error, identify what specifically failed, check the name and the path, check it is installed, and only then start changing things.
Mark this lesson complete
Signed in, your progress follows you to every device.