# Error: Failed to install plugin / Plugin not found (packer init)

## TL;DR
Packer cannot find the plugin your template requires. Run `packer init` in the template directory, verify the `source` address and `version` constraint in `required_plugins`, and check network access to the plugin registry.

## The error

```
Error: Failed to install plugin
Plugin not found
```

## Fix it

1. Run `packer init` (or `packer init [dir]`) in the directory containing your templates before `packer build`.
   - Success check: plugins download into the Packer plugin directory.
2. Verify the `required_plugins` block: `source` must be a valid address like `github.com/hashicorp/amazon`, and `version` must match a released version.
   - Success check: no typos in the source address; the version constraint is satisfiable.
3. Check network access from the build machine to `github.com` (plugin releases live there).
   - Success check: `curl -sI https://github.com` succeeds.
4. In CI, cache `~/.packer.d/plugins` between runs to avoid re-downloading.
   - Success check: subsequent runs skip the download.

## When to use this
You hit this on `packer init` or at build start when a required plugin cannot be installed.

## When NOT to use this
Do not use this for `Failed to initialize build "[builder]"` (plugin installed but builder unknown) or for checksum mismatches on downloaded plugins.

## Compatibility
Packer 1.7+ with the plugin framework (mandatory plugin installs since 1.10 for previously bundled builders).

## Variants
- `Error: Failed to install plugin` naming a specific plugin and version
- Init succeeding locally but failing in CI (network or cache issue)

## Root cause
Since Packer 1.10, builders that used to ship with Packer (like `amazon-ebs`) require explicit plugin installation. A missing `packer init`, a wrong source address, or no network produces this failure.

## Edge cases
- `packer plugins install github.com/hashicorp/amazon` installs one plugin directly without a template; useful for debugging.
- Version constraints like `>= 1.0.0, < 2.0.0` can fail if no release satisfies both. Loosen or pin explicitly.
