question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Unable to run Python version of cdk8s

See original GitHub issue

Describe the bug Created new cdk8s python project and ran cdk8s synth got following error.

Error: the command ./main.py could not be found within PATH or Pipfile's [scripts].
Error: non-zero exit code 1
    at ChildProcess.<anonymous> (/usr/local/Cellar/cdk8s/0.21.0/libexec/lib/node_modules/cdk8s-cli/lib/util.js:18:27)
    at Object.onceWrapper (events.js:418:26)
    at ChildProcess.emit (events.js:311:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

Also tried running hello-python example getting following error:

Traceback (most recent call last):
  File "./main.py", line 2, in <module>
    from constructs import Construct
ModuleNotFoundError: No module named 'constructs'
Error: non-zero exit code 1
    at ChildProcess.<anonymous> (/usr/local/Cellar/cdk8s/0.21.0/libexec/lib/node_modules/cdk8s-cli/lib/util.js:18:27)
    at Object.onceWrapper (events.js:418:26)
    at ChildProcess.emit (events.js:311:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

To Reproduce

  1. Initialized app using cdk8s init python-app
  2. pipenv install followed by cdk8s import --language python then ran cdk8s synth

For hello-python followed instructions from README which is same as step 2

Expected behavior To get manifest files in dist folder

Additional context Operating System: macOS Mojave Python version: 3.8 and 3.7 Pipenv version: 2018.11.26 cdk8s Installation method: Homebrew Shell: Tried with Bash, Zsh, Fish

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
030commented, May 28, 2020

@eladb Sorry, but it does not seem to work. I just installed 0.24.0 and when I issue cdk8s, a command not found is returned. If I run the sample code, it does not work as well:

from constructs import Construct, Node

from imports import k8s

python file.py, returns:

Traceback (most recent call last):
  File "file.py", line 4, in <module>
    from imports import k8s
ModuleNotFoundError: No module named 'imports'
0reactions
trevorrobertsjrcommented, Jun 2, 2020

For anyone who may be running into this. I resolved due to a hint I picked up in the CDK documentation that pointed to cdk.json as an area that may need to be updated: https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-python.html

cdk8s doesn’t have this config file, AFAIK, but I changed the Python interpreter command in in the cdk8s-generated main.py to python3 instead of python due to way that Python 3.7 is installed on my Mac.

Now my Mac is correctly-generating Python-based cdk8s manifests. I hope that helps someone else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Unable to run Python version of cdk8s · Issue #170
Describe the bug Created new cdk8s python project and ran cdk8s synth got following error. Error: the command ./main.py could not be found ......
Read more >
Python - cdk8s
If any init container fails, the pod is considered to have failed and is ... will only count 3 missed schedules, and thus...
Read more >
Announcing Java support for cdk8s | Containers - Amazon AWS
In this tutorial, we'll learn how to use Java cdk8s to define a simple deployment of a load balancer service that will front...
Read more >
Integrating cdk8s with Argo CD - Max Brenner
I'm going to use Python but feel free to go with TypeScript. ... Unable to generate manifests in cdk8s-guestbook: rpc error: code =...
Read more >
Write your Kubernetes Infrastructure in Go with cdk8s - Vultr.com
cdk8s lets you import objects from any Kubernetes API version and also custom resource definitions for use. cdk8s allows you to define abstract ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found