-vvv option).Hi there,
Today a Docker container which houses an NLP training platform broke. It seems the issue is that Poetry isn't being installed properly into the container during the container build phase. I don't see any problems until I try to use the Poetry executable.
Here's some output from the Docker build:
Retrieving Poetry metadata
# Welcome to Poetry!
This will download and install the latest version of Poetry,
a dependency and package manager for Python.
It will add the `poetry` command to Poetry's bin directory, located at:
$HOME/.poetry/bin
This path will then be added to your `PATH` environment variable by
modifying the profile file located at:
$HOME/.profile
You can uninstall at any time with `poetry self:uninstall`,
or by executing this script with the --uninstall option,
and these changes will be reverted.
Installing version: 0.12.2
- Downloading poetry-0.12.2-linux.tar.gz (8.53MB)
Poetry (0.12.2) is installed now. Great!
To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.
To configure your current shell run `source $HOME/.poetry/env`
...
Step 8/15 : WORKDIR /app
---> Running in b3131b487bb2
Removing intermediate container b3131b487bb2
---> 8bab84b160e7
Step 9/15 : COPY pyproject.lock pyproject.toml /app/
---> f9a9ecb5af2d
Step 10/15 : RUN poetry update && poetry install
---> Running in 02c7de951592
/bin/sh: poetry: not found
The command '/bin/sh -c poetry update && poetry install' returned a non-zero code: 127
As recently as a few days ago this container built without any issue.
Do you execute source $HOME/.poetry/env before calling poetry?
Yes I did try that altho I'm not certain if it was part of the same RUN directive. I can give that another shot tomorrow.
It does indeed seem to work when sourced with the same RUN. For instance,
RUN source $HOME/.poetry/env && poetry update && poetry install
Thanks!
I am getting the same error, and running source is not an option, since it is a bash command, and not the sh command. Docker building uses sh, and not bash, and I don't know of a way to make it switch to bash @maxcountryman could you reopen this issue?
This has come up in other issues.
The simplest way to "fix" it is to call poetry with $HOME/.poetry/bin/poetry.
You can also do ENV PATH="${PATH}:/root/.poetry/bin" and then call poetry normally.
Both of those are pretty flawed, as I'm sure you'll agree. But they do the job!
If you're using a Dockerfile with python:rc-buster as base
RUN pip install --user poetry
ENV PATH="${PATH}:/root/.local/bin"
RUN poetry install
Most helpful comment
This has come up in other issues.
The simplest way to "fix" it is to call poetry with
$HOME/.poetry/bin/poetry.You can also do
ENV PATH="${PATH}:/root/.poetry/bin"and then call poetry normally.Both of those are pretty flawed, as I'm sure you'll agree. But they do the job!