Pulumi Error: 'failed to load language plugin python' Virtualenv/Toolchain Not Found
Fix Pulumi's 'failed to load language plugin python' error: repair a missing virtualenv, wrong toolchain setting, or unset PATH so pulumi up finds Python again.
- #pulumi
- #iac
- #troubleshooting
- #errors
Stuck on this Pulumi error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Exact Error Message
error: failed to load language plugin python: could not read plugin [/home/dev/.pulumi/bin/pulumi-language-python] stdout: EOF
error: could not get plugin info for language "python": could not find plugin for language python
error: an error occurred while advancing the preview: pulumi:providers:pulumi could not
resolve program: python: no such file or directory
You may also see Error: failed to prepare environment: virtualenv is not present or python not found on path — all are the Python language host failing to start before any resource is even evaluated.
What It Means
Pulumi does not run your Python program directly. The CLI launches a language plugin (pulumi-language-python), which in turn spawns a Python interpreter to execute your __main__.py. When Pulumi cannot find that interpreter, cannot activate the virtual environment declared in Pulumi.yaml, or the language host itself exits early, the plugin fails to load and the operation aborts before touching any provider.
This is an environment problem, not a bug in your infrastructure code. It happens most often after cloning a project onto a fresh machine, in CI runners with no virtualenv, or after upgrading Python and leaving a stale venv pointing at a deleted interpreter.
Common Causes
- The
virtualenvfolder referenced inPulumi.yaml(runtime: options: virtualenv: venv) does not exist or was never created. python3/pythonis not onPATHfor the shell or CI environment that runspulumi.- A stale
venvlinks to a Python version that has been removed or upgraded (broken symlink invenv/bin/python). - Dependencies were never installed, so the language host cannot import the
pulumipackage. - On newer projects,
runtime: options: toolchain: poetry(oruv) is set but Poetry/uv is not installed on the machine.
Diagnostic Commands
Confirm which interpreter Pulumi will try to use and whether it exists:
which python3 python
python3 --version
Inspect the runtime options Pulumi reads from the project file:
cat Pulumi.yaml
Look specifically for the runtime block, e.g. runtime: name: python and options: virtualenv: venv.
Check that the referenced virtualenv is real and its interpreter is not a broken symlink:
ls -l venv/bin/python
venv/bin/python -c "import pulumi; print(pulumi.__version__)"
Run Pulumi with verbose logging to see exactly how the language host is invoked and where it dies:
pulumi preview --logtostderr -v=9 2>pulumi.log
Step-by-Step Resolution
-
Read
Pulumi.yamland note thevirtualenv(ortoolchain) setting. Everything below assumes the commonvirtualenv: venv. -
Recreate the virtual environment with a valid interpreter:
python3 -m venv venv
- Install the project dependencies into that venv so the language host can import
pulumi:
venv/bin/python -m pip install --upgrade pip
venv/bin/python -m pip install -r requirements.txt
- Verify the interpreter can import the SDK — this is exactly what the language host does on startup:
venv/bin/python -c "import pulumi; print('ok', pulumi.__version__)"
- If you are using a toolchain instead of a raw virtualenv, install and sync it. For Poetry-managed projects:
poetry install
- Re-run the operation. Pulumi will now find and activate the environment:
pulumi preview
Previewing update (dev)
Type Name Plan
+ pulumi:pulumi:Stack myproj-dev
- If it still fails in CI, ensure the runner installs Python and creates the venv before
pulumi up, because Pulumi will not create it for you unlessPulumi.yamlexplicitly setsvirtualenvand you runpulumi install.
Prevention
- Commit the
runtime: options: virtualenv: venvsetting so every machine builds an isolated environment the same way, and never commit thevenv/directory itself. - Add
pulumi install(which creates the venv and installsrequirements.txt) as the first step of every CI job. - Pin your Python version with a
.python-versionor CI matrix so a host upgrade does not orphan the venv. - Keep
requirements.txt(orpyproject.toml) in sync and include a lower-boundpulumi>=constraint. - After upgrading system Python, delete and recreate the venv rather than reusing the broken one.
Related Errors
no resource plugin 'aws' found in the workspace— a missing provider plugin, resolved withpulumi plugin install, not a language-host failure.ModuleNotFoundError: No module named 'pulumi_aws'— the venv exists but a specific dependency was not installed.failed to load language plugin nodejs— the same class of problem for a TypeScript/JavaScript project.error: no stack selected— a stack-selection problem that appears after the language host loads successfully.
Frequently Asked Questions
Does Pulumi create the virtualenv automatically? Only when Pulumi.yaml declares virtualenv and you run pulumi install; otherwise you must create venv and install dependencies yourself before running any command.
Why does it work locally but fail in CI? CI runners usually have no virtualenv and sometimes no python on PATH, so add a step that installs Python and runs pulumi install before pulumi up.
How do I switch a project from a bare interpreter to a managed toolchain? Set runtime: options: toolchain: poetry (or uv) in Pulumi.yaml, then run poetry install so the toolchain owns dependency resolution.
My venv points at a Python that no longer exists — what now? Delete the folder and recreate it with python3 -m venv venv; a broken venv/bin/python symlink is a common cause after upgrading system Python. If you want ready-made prompts to debug and rebuild a broken Pulumi environment, browse the Pulumi prompt library.
Where can I find more fixes like this? See the full Pulumi guides for language-host and provider troubleshooting.
Fixed it? Get 500 Pulumi & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.