Closed ratnadeep007 closed 4 years ago
The app was installed using pip see, https://pypi.org/project/cdk8s/0.21.0/, but when cdk8s
is run, the command cannot be found.
Not reproducing in 0.23.0. Closing for now. Please reopen if this persists.
@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'
Do you have an imports
directory in your project? (did you run cdk8s import
?).
Also, what python version are you using?
pip3 list
Package Version
---------------------- -------------
cdk8s 0.24.0
python3 --version
Python 3.8.2
Although cdk8s has been installed according to pip, the executable cannot be found on the path, while this works for other python executables.
Additional context Operating System: macOS Mojave Python version:3.7 Pipenv version: version 2020.6.2 cdk8s Installation method: Homebrew (0.24.0) Shell: Bash
I'm getting the following error output when I try to do a cdk8s init:
`{ Error: Command failed: pipenv run ./main.py Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. Warning: There was an unexpected error while activating your virtualenv. Continuing anyway... File "./main.py", line 7 def init(self, scope: Construct, ns: str): ^ SyntaxError: invalid syntax
at checkExecSyncError (child_process.js:629:11)
at execSync (child_process.js:666:13)
at Object.exports.post.options [as post] (/usr/local/Cellar/cdk8s/0.24.0/libexec/lib/node_modules/cdk8s-cli/templates/python-app/.hooks.sscaff.js:27:3)
at executePostHook (/usr/local/Cellar/cdk8s/0.24.0/libexec/lib/node_modules/cdk8s-cli/node_modules/sscaff/lib/sscaff.js:61:37)
at Object.sscaff (/usr/local/Cellar/cdk8s/0.24.0/libexec/lib/node_modules/cdk8s-cli/node_modules/sscaff/lib/sscaff.js:28:15)
status: 1, signal: null, output: [ null,
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.
Describe the bug Created new cdk8s python project and ran
cdk8s synth
got following error.Also tried running hello-python example getting following error:
To Reproduce
cdk8s init python-app
pipenv install
followed bycdk8s import --language python
then rancdk8s 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