Can pnpm Manage Python Dependencies?
pnpm added experimental, opt-in Python support in September 2026: PyPI packages, automatic interpreters and managed virtual environments, tested
Yes, but experimentally: pnpm 12.4 (8 September 2026) added opt-in Python support, and 12.5 (18 September) extended it with PyPI package URLs, automatic interpreter installation and virtual environments stored in pnpm’s own store. It is off by default, and pnpm’s documentation warns that the settings and the layout it writes may change. Here is how to switch it on, what it did when tested, and who it is for.
How to turn it on
Python support is a setting. Add this to pnpm-workspace.yaml (its default is false):
python:
enabled: trueThen add a package with the pypi: prefix:
pnpm add pypi:httpxpnpm reads the project’s pyproject.toml, writes a pylock.toml and builds an environment. In a test on pnpm 12.18.0 with an empty pyproject.toml, that one command:
- added
httpx>=0.28.1to the project’sdependencies - created a
pylock.toml(created-by = "pnpm") - made
.venva symlink into apython-envsfolder inside the pnpm store - let
pnpm exec pythonimport httpx straight away, with no activation step
The 12.5 release also accepts a Package URL in place of a name, so pnpm add pkg:pypi/requests@2.31.0 saves requests to pyproject.toml in the same way pkg:npm/express@4.18.2 saves an npm package. A bare name@version is written as an exact pin, and a requirement with an operator is kept as written.
What pnpm added
- PyPI packages.
pypi:names, and Package URLs from 12.5, install from PyPI. Indexes are declared underregistrieswithecosystem: pypi, and pnpm falls back tohttps://pypi.org/simple/when none is declared. - Automatic interpreter management. pnpm chooses, for each project, the first interpreter on the machine that satisfies its
requires-python, preferring.python-versionwhen there is one. If none fits, it downloads a python-build-standalone build (the same builds uv installs), shared by every project on the machine. In testing, a project requiring Python 3.11 on a machine without it printed “Installing Python 3.11.18” and then ran on it. TheruntimeOnFailsetting decides what happens when nothing fits:errorfails, andwarnorignoreuse an interpreter that doesn’t match. - Managed virtual environments. Since 12.5, environments live in the store and each project keeps only its
.venvlink. pnpm refuses to touch a.venvit didn’t create, so a hand-made environment is never replaced. - Multi-platform lock files. pnpm can resolve one
pylock.tomlfor several platforms and Python versions, usingsupportedArchitecturesandpython.versions, so one committed lockfile serves Linux CI and macOS or Windows contributors.
Why a JavaScript package manager is doing this
pnpm’s core design is a single content-addressable store shared across projects, with per-project links into it instead of duplicated copies. pnpm’s documentation says the same plumbing (the connection budget, artifact verification and the store) is shared, while Python’s requirement, marker and lockfile rules are kept separate from npm’s and Cargo’s. A wheel fetched for one project is reused by the next. The same release line also added Cargo support, so this is pnpm becoming a multi-ecosystem tool.
Who this is actually for
This isn’t a reason for a Python-only project to switch package managers. uv, Poetry and Hatch remain the right defaults there, and pnpm’s Python support doesn’t change that comparison. See Python package managers compared for how to choose between them.
It matters for a team that already runs pnpm for a JavaScript or TypeScript codebase and also has a Python component, such as a data pipeline, a backend service or a build script, and previously needed a separate tool for the Python side. With this feature, one pnpm install resolves both graphs.
How new this is
Treat it as experimental. pnpm’s own documentation carries a warning that multi-ecosystem support is experimental and that its settings and layout may change, and the feature is off unless you enable it. pnpm 12.4 introduced it and 12.5 changed where environments live, so even the on-disk layout has already moved once.
It is being actively worked on, though. In the weeks since 12.5, releases have added routing of packages to specific indexes (12.5.1), skipped nested workspaces (12.10.1), fixed uv_build projects and sped up resolution (12.13.0), taught pnpm outdated and pnpm update to handle Python dependencies (12.17.0) and fixed a pnpm update failure with Python requirements (12.18.0, 5 November 2026). If you are in the target audience, try it on a real project first, and don’t rely on it as your only Python tooling yet.
Tested on 7 November 2026 with pnpm 12.18.0 on macOS, using a throwaway project and a temporary store. Behaviour in later releases may differ.
Frequently Asked Questions
Can pnpm install Python packages?
Yes, as an experimental, opt-in feature. pnpm 12.4 (8 September 2026) added Python support and 12.5 extended it. You switch it on with python enabled set to true in pnpm-workspace.yaml, then pnpm add pypi:httpx writes the dependency to pyproject.toml, locks it in pylock.toml and installs it into a managed .venv. pnpm’s own documentation warns the settings and layout may change.
Does pnpm manage Python virtual environments?
Yes. Each project’s .venv is a symlink into a python-envs folder inside pnpm’s store, and pnpm run and pnpm exec put the environment’s executables on the PATH. In testing, pnpm exec python imported a package installed through pnpm without activating anything.
Does pnpm install Python itself if it’s missing?
Yes. pnpm picks the first interpreter on the machine that satisfies the project’s requires-python, preferring a .python-version file, and downloads a python-build-standalone build if none fits. In testing, a project requiring Python 3.11 on a machine without it triggered an automatic install of Python 3.11.18. The runtimeOnFail setting can turn the download into an error or a warning.
Should a Python-only project switch to pnpm?
No. A project with no JavaScript component has no reason to adopt a JavaScript package manager, and the feature is still experimental. It matters for teams that already use pnpm for a JavaScript or TypeScript codebase and want one tool and one install command for a Python component as well.