Repository navigation
Description
Expected Behavior
cdktn init should be successful.
Actual Behavior
cdktn init errors out.
Steps to Reproduce
Do not have Python 3.11 installed.
Fairly new/fresh Ubuntu 26.04 installation with Python 3.14 installed.
$ cdktn init
Welcome to CDK Terrain!
By default, cdktn allows you to manage the state of your stacks using Terraform Cloud for free.
cdktn will request an API token for app.terraform.io using your browser.If login is successful, cdktn will store the token in plain text in
the following file for use by subsequent Terraform commands:
/home/a/.terraform.d/credentials.tfrc.jsonNote: The local storage mode isn't recommended for storing the state of your stacks.
? Do you want to continue with Terraform Cloud remote state management? no
? What template do you want to use? pythonInitializing a project using the python template.
? Project Name test-proj
? Project Description Test Project
? Do you want to send crash reports to the CDKTN team? Refer to https://cdktn.io/docs/create-and-deploy/configuration-file#enable-crash-reporting-for-the-cli for more information yes
Note: You can always add providers using 'cdktn provider add' later on
? What providers do you want to use? aws
Warning: Python 3.11 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path/to/python
Command failed: pipenv install
Error: Command failed: pipenv install
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:916:11)
at execSync (node:child_process:988:15)
at exports.post (/usr/local/lib/node_modules/cdktn-cli/bundle/templates/python/.hooks.sscaff.js:37:3)
at o (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:161:9342)
at vPt (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:161:8806)
at async TPt (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:162:4)
at async sHe (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:499:2968)
at async Object.Pqe (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:500:108865)
Collecting Debug Information...
/usr/local/lib/node_modules/cdktn-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^Error: Command failed: pipenv install
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at checkExecSyncError (node:child_process:916:11)
at execSync (node:child_process:988:15)
at exports.post (/usr/local/lib/node_modules/cdktn-cli/bundle/templates/python/.hooks.sscaff.js:37:3)
at o (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:161:9342)
at vPt (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:161:8806)
at async TPt (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:162:4)
at async sHe (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:499:2968)
at async Object.Pqe (/usr/local/lib/node_modules/cdktn-cli/bundle/bin/cmds/handlers.js:500:108865) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 99491,
stdout: null,
stderr: null
}Node.js v22.22.1
Versions
language: python
cdktn-cli: 0.23.3
node: v22.22.1
cdktn: 0.23.3
cdktf: null
constructs: 10.6.0
jsii: 1.137.0
terraform: 1.12.3
arch: x64
os: linux 7.0.0-27-generic
python: Python 3.14.4
pip: pip 26.1.2 from /home/a/.local/share/virtualenvs/test-proj-qLiTVeAE/lib/python3.14/site-packages/pip (python 3.14)
pipenv: pipenv, version 2026.6.2
Migration Context
Not sure / don't remember
Upstream cdktf Issue
No response
Providers
┌───────────────┬──────────────────┬───────┬─────────┬────────────┬────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ CDKTN │ Constraint │ Package Name │ Package Version │
├───────────────┼──────────────────┼───────┼─────────┼────────────┼────────────────────┼─────────────────┤
│ aws │ 6.52.0 │ │ ^0.23.0 │ │ cdktn-provider-aws │ 24.8.0 │
└───────────────┴──────────────────┴───────┴─────────┴────────────┴────────────────────┴─────────────────┘
Gist
No response
Possible Solutions
No response
Workarounds
If I enter the pipenv shell, wipe out the partial project files (including the Pipfile stating to use Python 3.11), I can then re-init the project and it will warn that the Pipefile has Python 3.11 but it is now using Python 3.14 as per the pipenv.
$ ls
Pipfile cdktf.json help main-test.py main.py
$ pipenv shell
Creating a virtualenv for this project
Pipfile: /home/a/.../Pipfile
Using /usr/bin/python3 3.14.4 to create virtualenv...
⠹ Creating virtual environment...created virtual environment CPython3.14.4.final.0-64-x86_64 in 564ms
creator CPython3Posix(dest=/home/a/.local/share/virtualenvs/test-proj-qLiTVeAE, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/home/a/.cache/virtualenv)
added seed packages: pip==26.1.2
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator,XonshActivator✔ Successfully created virtual environment!
Virtualenv location: /home/a/.local/share/virtualenvs/test-proj-qLiTVeAE
Launching subshell in virtual environment...
(test-proj) $ ls
Pipfile Pipfile.lock cdktf.json help main-test.py main.py
(test-proj) $ rm *
$ cdktn init
Welcome to CDK Terrain!
By default, cdktn allows you to manage the state of your stacks using Terraform Cloud for free.
cdktn will request an API token for app.terraform.io using your browser.If login is successful, cdktn will store the token in plain text in
the following file for use by subsequent Terraform commands:
/home/a/.terraform.d/credentials.tfrc.jsonNote: The local storage mode isn't recommended for storing the state of your stacks.
? Do you want to continue with Terraform Cloud remote state management? no
? What template do you want to use? pythonInitializing a project using the python template.
? Project Name test-proj
? Project Description Test Project
? Do you want to send crash reports to the CDKTN team? Refer to https://cdktn.io/docs/create-and-deploy/configuration-file#enable-crash-reporting-for-the-cli for more information yes
Note: You can always add providers using 'cdktn provider add' later on
? What providers do you want to use? aws
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Pipfile.lock not found, creating...
Locking dependencies...
Locking dependencies...
Updated Pipfile.lock (ed6d5d614626ae28e274e453164affb26694755170ccab3aa5866f093d51d3e4)!
Installing dependencies from Pipfile.lock (51d3e4)...
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing cdktn~=0.23.3...
✔ Installation Succeeded
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing dependencies from Pipfile.lock (51d3e4)...
All dependencies are now up-to-date!
Upgrading cdktn~=0.23.3 in dependencies.
Building requirements...
Resolving dependencies...
✔ Success!
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing dependencies from Pipfile.lock (4771ea)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (4771ea)...
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing pytest...
✔ Installation Succeeded
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing dependencies from Pipfile.lock (4771ea)...
All dependencies are now up-to-date!
Upgrading pytest in dependencies.
Building requirements...
Resolving dependencies...
✔ Success!
Building requirements...
Resolving dependencies...
✔ Success!
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing dependencies from Pipfile.lock (5306bc)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (5306bc)...Your cdktn Python project is ready!
cat help Prints this message
Compile:
pipenv run ./main.py Compile and run the python code.Synthesize:
cdktn synth [stack] Synthesize Terraform resources to cdktf.out/Diff:
cdktn diff [stack] Perform a diff (terraform plan) for the given stackDeploy:
cdktn deploy [stack] Deploy the given stackDestroy:
cdktn destroy [stack] Destroy the given stackLearn more about using modules and providers https://cdktn.io/docs/concepts/providers
Use Providers:
You can add prebuilt providers (if available) or locally generated ones using the add command:
cdktn provider add "aws@~>3.0" null kreuzwerker/docker
You can find all prebuilt providers on PyPI: https://pypi.org/user/cdktn-team/
You can also install these providers directly through pipenv:pipenv install cdktn-provider-aws
pipenv install cdktn-provider-google
pipenv install cdktn-provider-azurerm
pipenv install cdktn-provider-docker
pipenv install cdktn-provider-github
pipenv install cdktn-provider-nullYou can also build any module or provider locally. Learn more: https://cdktn.io/docs/concepts/providers
========================================================================================================
[2026-06-26T15:42:46.079] [INFO] default - Checking whether pre-built provider exists for the following constraints:
provider: aws
version : latest
language: python
cdktf : 0.23.3[2026-06-26T15:42:47.181] [INFO] default - Found pre-built provider.
Installing package cdktn-provider-aws @ 24.8.0 using pipenv.
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Installing cdktn-provider-aws~=24.8.0...
✔ Installation Succeeded
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Upgrading cdktn-provider-aws~=24.8.0 in dependencies.
Building requirements...
Resolving dependencies...
✔ Success!
Building requirements...
Resolving dependencies...
✔ Success!
Warning: Your Pipfile requires "python_version" 3.11, but you are using 3.14.4 from /home/a/.local/share/v/c/bin/python.
$ pipenv --rm and rebuilding the virtual environment may resolve the issue.
$ pipenv check will surely fail.
Package installed.
(test-proj) $ ls
Pipfile Pipfile.lock cdktf.json help main-test.py main.py
Update the Pipfile to have 3.14 and cdktn synth on the base project succeeds:
(test-proj) $ cat Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true[requires]
python_version = "3.14"[packages]
cdktn = "=0.23.3"=24.8.0"
pytest = "*"
cdktn-provider-aws = "[dev-packages]
(test-proj) $ cdktn synth
Generated Terraform code for the stacks: test-proj
Anything Else?
I have a workaround, so it's not a show stopper, but it's a bit annoying.
References
No response
Help Wanted
- I'm interested in contributing a fix myself
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Activity
chore: add OpenTofu and current Terraform to the jsii-terraform image (…
chore: Flexible python version (#420)
github-actions commentedon Oct 13, 2026
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.