cdk8s-team / cdk8s-cli

Apache License 2.0
39 stars 23 forks source link

cdk8 init python-app fails "{ Error: Command failed: pipenv install cdk8s~=0.26.0" #35

Closed walidshaari closed 3 years ago

walidshaari commented 4 years ago

Description of the bug:

from over 20-30 inits for python-app, I have only two successful inits and always successful typescript-app. tried updating packages and using a new user to ensure I have a clean environment.

cdk8s init python-app does not initiate an app, fails during the pipenv install cdk8s

Reproduction Steps:

Error Log:

cdk8s init python-app
Initializing a project from the python-app template
Creating a virtualenv for this project…
Using /usr/bin/python3.7m (3.7.8) to create virtualenv…
⠋created virtual environment CPython3.7.8.final.0-64 in 198ms
  creator CPython3Posix(dest=/home/walid/.local/share/virtualenvs/test2-VudGC1Ld, clear=False, global=False)
  seeder FromAppData(download=False, contextlib2=latest, pytoml=latest, retrying=latest, progress=latest, setuptools=latest, webencodings=latest, pep517=latest, html5lib=latest, requests=latest, urllib3=latest, lockfile=latest, pyparsing=latest, pip=latest, certifi=latest, distro=latest, ipaddr=latest, chardet=latest, packaging=latest, appdirs=latest, CacheControl=latest, six=latest, wheel=latest, msgpack=latest, distlib=latest, colorama=latest, pkg_resources=latest, idna=latest, via=copy, app_data_dir=/home/walid/.local/share/virtualenv/seed-app-data/v1.0.1.debian)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

Virtualenv location: /home/walid/.local/share/virtualenvs/test2-VudGC1Ld
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (832b5d)!
Installing dependencies from Pipfile.lock (832b5d)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 8/8 — 00:00:01
To activate this project's virtualenv, run the following:
 $ pipenv shell
Installing cdk8s~=0.26.0…
Collecting cdk8s~=0.26.0
  Using cached cdk8s-0.26.0-py3-none-any.whl (205 kB)
Requirement already satisfied: publication>=0.0.3 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from cdk8s~=0.26.0) (0.0.3)
Requirement already satisfied: jsii<2.0.0,>=1.7.0 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from cdk8s~=0.26.0) (1.8.0)
Requirement already satisfied: constructs==2.0.2 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from cdk8s~=0.26.0) (2.0.2)
Requirement already satisfied: attrs~=19.3.0 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from jsii<2.0.0,>=1.7.0->cdk8s~=0.26.0) (19.3.0)
Requirement already satisfied: cattrs~=1.0.0 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from jsii<2.0.0,>=1.7.0->cdk8s~=0.26.0) (1.0.0)
Requirement already satisfied: python-dateutil in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from jsii<2.0.0,>=1.7.0->cdk8s~=0.26.0) (2.8.1)
Requirement already satisfied: typing-extensions~=3.7.4 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from jsii<2.0.0,>=1.7.0->cdk8s~=0.26.0) (3.7.4.2)
Requirement already satisfied: six>=1.5 in /home/walid/.local/share/virtualenvs/test2-VudGC1Ld/lib/python3.7/site-packages (from python-dateutil->jsii<2.0.0,>=1.7.0->cdk8s~=0.26.0) (1.15.0)
Installing collected packages: cdk8s
Successfully installed cdk8s-0.26.0

Adding cdk8s~=0.26.0 to Pipfile's [packages]…
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 527, in write_toml
    formatted_data = contoml.dumps(data).rstrip()
  File "/usr/lib/python3/dist-packages/pipenv/patched/contoml/__init__.py", line 36, in dumps
    raise RuntimeError("Can only dump a TOMLFile instance loaded by load() or loads()")
RuntimeError: Can only dump a TOMLFile instance loaded by load() or loads()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 349, in install
    core.do_install(
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1979, in do_install
    project.add_package_to_pipfile(package_name, dev)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 610, in add_package_to_pipfile
    self.write_toml(p)
  File "/usr/lib/python3/dist-packages/pipenv/project.py", line 530, in write_toml
    for package in data[section]:
KeyError: 'dev-packages'
cdk8s init TYPE

Create a new cdk8s project from a template.

Positionals:
  TYPE  Project type                                                                                         [required] [choices: "java-app", "python-app", "typescript-app"]

Options:
  --version        Show version number                                                                                                                              [boolean]
  --help           Show help                                                                                                                                        [boolean]
  --dist           Install dependencies from a "dist" directory (for development)                                                                                    [string]
  --cdk8s-version  The cdk8s version to use when creating the new project                                                                        [string] [default: "0.26.0"]

{ Error: Command failed: pipenv install cdk8s~=0.26.0
    at checkExecSyncError (child_process.js:629:11)
    at execSync (child_process.js:666:13)
    at Object.exports.post.options [as post] (/usr/local/lib/node_modules/cdk8s-cli/templates/python-app/.hooks.sscaff.js:23:3)
    at executePostHook (/usr/local/lib/node_modules/cdk8s-cli/node_modules/sscaff/lib/sscaff.js:61:37)
    at Object.sscaff (/usr/local/lib/node_modules/cdk8s-cli/node_modules/sscaff/lib/sscaff.js:28:15)
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1586175,
  stdout: null,
  stderr: null }

Environment:

Other:

initially the issue was my python 3.8, however, I fixed this with useing alternatives.

wal@Bei:~/code/gitrepos/cdk8s/tst$ sudo update-alternatives --config python There are 3 choices for the alternative python (providing /usr/bin/python).

Selection Path Priority Status

0 /usr/bin/python3.7 3 auto mode 1 /usr/bin/python2 1 manual mode 2 /usr/bin/python3 2 manual mode

also made sure I have an updated pipenv /usr/bin/pip3 install --user --upgrade pipenv and used this too pipenv --python /usr/bin/python3.7 # not sure why, so it in another report

now it worked twice


This is :bug: Bug Report

eladb commented 4 years ago

@walidshaari Is this still an issue?

walidshaari commented 4 years ago

Need to try it out again. pushed back due to pending tasks, might have sometime after kubecon. I wanted to present it in AWS MENA days

kristianpaul commented 3 years ago

This also happened to me , workaround was not using pipenv from apt but instead install it from pip3

github-actions[bot] commented 3 years ago

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

github-actions[bot] commented 3 years ago

Closing this issue as it hasn't seen activity for a while. Please add a comment @mentioning a maintainer to reopen.