cdktf provider add fails with "no matching distribution found" for the AWS provider version
Fixes the cdktf provider add failure where pip cannot find the requested cdktf-cdktf-provider-aws version (e.g. v9.0.36). Covers installing the provider package directly with pipenv/pip instead of provider add. Use when provider add fails on version resolution for Python. Not for TypeScript npm issues.
TL;DR
Install the provider package directly: pipenv install cdktf-cdktf-provider-aws (or pip install cdktf-cdktf-provider-aws==[version]), instead of going through cdktf provider add for that version.
The error
Running cdktf provider add "aws@~>4.0" fails because pip reports no matching distribution for the resolved version (e.g. v9.0.36).
Fix it
- Skip
cdktf provider addfor this provider. - Install the pre-built Python provider package directly:
pipenv install cdktf-cdktf-provider-awsor pin it:pip install "cdktf-cdktf-provider-aws==[version]". - Run
cdktf synthand confirm the AWS constructs resolve.
Expected result: synth succeeds with the AWS provider available.
When to use this
cdktf provider add "aws@~>4.0"(or similar) fails with "no matching distribution found"- You use Python and want the pre-built provider
When NOT to use this
- The failure is a network/proxy error rather than version resolution
- You use TypeScript (use npm and @cdktf/provider-aws)
Root cause
cdktf provider add resolves a provider version and then shells out to the language package manager; when the resolved version has no published artifact for that language (a release-skew window), the install fails. Installing the package directly lets you pick a version that actually exists on PyPI.
Edge cases
- Pin the version in your Pipfile/requirements so CI does not re-resolve to the missing one.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.