Skip to content

/flags/pip/pip-install-no-deps

pip install --no-deps: install a package without its dependencies

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · pip 26.2.2 fromupdated
tool
pip
command
pip install, pip download, pip wheel
flag
--no-deps
default
off (dependencies are resolved and installed)

pip install --no-deps PKG installs only the named package and ignores its declared dependencies: pip does not resolve them, does not download them and does not upgrade them. Use it when you already manage the dependencies yourself (a fully pinned requirements file, a conda or system package that provides them) or to replace one package without touching the rest. The option works the same way for pip download and pip wheel, which is how the examples show it without modifying an environment.

With and without --no-deps

requests depends on four other packages:

bash
pip download --disable-pip-version-check -q -d full requests==2.32.3
echo "--- pip download requests"
ls full | sed -E 's/-[0-9].*$//'
pip download --disable-pip-version-check -q --no-deps -d only requests==2.32.3
echo "--- pip download --no-deps requests"
ls only | sed -E 's/-[0-9].*$//'

Output

--- pip download requests
certifi
charset_normalizer
idna
requests
urllib3
--- pip download --no-deps requests
requests

The sed keeps only the project names of the wheel files. Without the flag pip fetches certifi, charset_normalizer, idna and urllib3 too; with it, only requests.

When it is the right tool

SituationWhy --no-deps helps
Fully pinned requirements (pip-compile, pip freeze)Every dependency is already listed; skipping resolution makes the install faster and exact
Installing your own package in a prepared imagepip install --no-deps . installs the project without re-resolving dependencies installed earlier
A dependency comes from conda or the OSPrevents pip from installing a second copy over it
A package declares a too-strict dependencyInstall it alone, then the version you actually need
Downloading a single wheelpip download --no-deps gets one file for inspection

Check what is missing

After a --no-deps install the environment may be incomplete. pip check reports it:

bash
pip install --no-deps requests==2.32.3
pip check
# requests 2.32.3 requires certifi, which is not installed.
# requests 2.32.3 requires idna, which is not installed.

An import of the missing module then fails at runtime with ModuleNotFoundError. To see what a package declares, pip show NAME lists Requires and Required-by; see pip show.

Pitfalls

  • --no-deps also stops upgrades: pip install -U --no-deps pkg updates pkg only, even if the new version needs newer dependencies. Run pip check afterwards.
  • Extras are ignored: pip install --no-deps "pkg[extra]" does not install the extra's packages.
  • Build dependencies of an sdist are separate from runtime dependencies; with build isolation pip still installs the build backend (setuptools, hatchling) into a temporary environment.
  • For a frozen file from pip freeze, combine --no-deps with --require-hashes for an install that is both exact and verified.

FAQ

How do I find out which dependencies are missing after --no-deps?

Run pip check. It lists every installed package whose requirements are not satisfied, for example 'requests 2.32.3 requires idna, which is not installed.' and exits with code 1.

Does --no-deps apply to packages in requirements.txt?

It applies to everything in that pip call: the packages from -r files are installed, but none of their dependencies. That is what you want for a fully pinned file that already lists every dependency, such as one produced by pip-compile or pip freeze.

Can I skip only one dependency?

Not with pip itself. The usual approaches are installing the package with --no-deps and then its other dependencies explicitly, or using a constraints file to steer the version of the dependency instead of skipping it.

Sources