Error while use poetry in circleci
pbzweihander opened this issue · comments
Kangwook Lee (이강욱) commented
Error output:
#!/bin/bash -eo pipefail
python -m venv venv
. venv/bin/activate
poetry -vvv --version
poetry install
[ValueError]
invalid width -1 (must be > 0)
Traceback (most recent call last):
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/console_application.py", line 132, in run
status_code = command.handle(parsed_args, io)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 119, in handle
status_code = self._do_handle(args, io)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/api/command/command.py", line 159, in _do_handle
self._dispatcher.dispatch(ConsoleEvents.PRE_HANDLE.value, event)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py", line 22, in dispatch
self._do_dispatch(listeners, event_name, event)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
listener(event, event_name, self)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/config/default_application_config.py", line 161, in print_version
version.render(event.io)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/name_version.py", line 28, in render
paragraph.render(io, indentation)
File "/home/circleci/.poetry/lib/poetry/_vendor/py3.7/clikit/ui/components/paragraph.py", line 25, in render
'
'".join(textwrap.wrap(self._text, text_width)),
File "/usr/local/lib/python3.7/textwrap.py", line 379, in wrap
return w.wrap(text)
File "/usr/local/lib/python3.7/textwrap.py", line 354, in wrap
return self._wrap_chunks(chunks)
File "/usr/local/lib/python3.7/textwrap.py", line 248, in _wrap_chunks
raise ValueError('invalid width %r (must be > 0)' % self.width)
Exited with code 1
CircleCI setting:
...
- run:
name: Install dependencies
command: |
python -m venv venv
. venv/bin/activate
poetry -vvv --version
poetry install
...
I think clikit evaluate terminal width as 0 when in the circleci
Alexey Shamrin commented
I have a similar problem with poetry 1.0.0b1 in CircleCI when running poetry --version
:
[ValueError]
invalid width -1 (must be > 0)
Nick Presta commented
@pbzweihander @shamrin Hi! I am having a different poetry
problem (that looks like a clikit
problem) on CircleCI. Here's what I found and how I "fixed" the issue:
- Running
poetry show
automatically in CirleCI was cutting off everything but the first column (the package names). When I SSH'ed into the container manually and ranpoetry show
everything was fine (all columns, etc). - The
TERM
environment variable in my Python image was set todumb
when running on CircleCI automatically, but SSH'ing in the container sets theTERM
environment variable toxterm-256color
. - The
COLUMNS
environment variable is not set when running automatically, but when SSH'ing it, it's set to something reasonable (e.g.150
).
In my run
section, I added:
run:
name: Something With Poetry
command: |
export TERM=xterm-256color
export COLUMNS=150
poetry show
and everything seems fine now.