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.

`poetry install` needs a `--force-root` or similar flag for Docker

See original GitHub issue

I’ve been hacking at this for a couple hours now and I can’t find an elegant way to use poetry to install dependencies inside of a Docker container (during build).

It either creates it’s own virtualenv which is tricky to use when you’re doing multistage or multi-base (docker compose) deployments. Or, if you supply a .venv it won’t activate it properly and installs can fail.

RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
COPY ./pyproject.toml /app
COPY ./pyproject.lock /app
RUN python -m poetry install --no-interaction --allow-root-install

I propose a documented config setting along the lines of settings.virtualenvs.use_root true or a install flag which conveys this as an exception to the normal flow.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
sdispatercommented, Jun 15, 2018

If you don’t want poetry to automatically create virtualenvs you can set the settings.virtualenvs.create to false like so:

poetry config settings.virtualenvs.create false
4reactions
blakevcommented, Oct 25, 2018

This does not work anymore as of poetry 0.12.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

poetry install needs a --force-root or similar flag for Docker #218
I've been hacking at this for a couple hours now and I can't find an elegant way to use poetry to install dependencies...
Read more >
Integrating Python Poetry with Docker - Stack Overflow
There are several things to keep in mind when using poetry together with docker . Installation. Official way to install poetry is via:...
Read more >
Introduction | master | Documentation | Poetry - Python ...
Poetry requires Python 3.7+. It is multi-platform and the goal is to make it work equally well on Linux, macOS and Windows. Installation...
Read more >
duffn/python-poetry - Docker Image
A series of Python Docker images that use poetry for dependency management. Because this is what I tend to do, these images also:...
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
Adding a development dependency works in a similar fashion with the only caveat that you need to use the --dev flag when executing...
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