Adding dependencies per "Packaging Python Projects"

FYI, pip list is the command to run to see what’s currently installed in your environment.

Presumably, the dependency wasn’t listed under the appropriate key for listing run-time requirements for your chosen build backend (e.g. install_requires under [metadata] in setup.cfg for Setuptools, dependencies under [project] in pyproject.toml for the new format specified in PEP 621).

If you only listed your dependencies in a requirements.txt file, it will not be installed automatically. The use of requirements.txt files (often generated by pip freeze or pip-tools) is generally for manual installation for development and applications that need to reproduce a given environment exactly, or other specialized applications, and must be manually specified by e.g. pip install -r requirements.txt.

To elaborate, in reasonably recent versions of Setuptools, you can decoratively specify your metadata and build config in a static setup.cfg. This is simpler, much harder to mess up and has many benefits over using a dynamic setup.py file for the same purpose, and tools exist to convert the latter to the former. While in recent-enough Setuptools you can omit the setup.py completely, its probably best to retain a stub setup.py for now, e.g.

#!/usr/bin/env python3

"""Stub setup.py for use with legacy build tooling."""

import setuptools

if __name__ == "__main__":
    setuptools.setup()

to accommodate legacy tooling and use cases.

Furthermore, forthcoming versions of Setuptools will gain support for specifying dependencies in the PEP 621-specified [project] table of pyproject.toml, which will work with any build backend (Flit, Setuptools, Poetry, PDM, Hatch, etc) once they support it (which with Setuptools adding support, leaves Poetry as the main laggard here).

[project]
dependencies = [
    "json5 >= 0.9.6",
]