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 is impossible to install on the python docker images.

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Poetry will not install on the docker images.

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

This gives the “module not found” error with “cleo” as the missing module, same as #3345.

If I try the workaround in that issue-

install_url="https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py"
curl -sSL "$install_url" | POETRY_HOME=$install_path python3 - --git "https://github.com/python-poetry/poetry.git@master"

I just get more errors-

app_1  | The canonical source for Poetry's installation script is now https://install.python-poetry.org. Please update your usage to reflect this.
app_1  | # Welcome to Poetry!
app_1  |
app_1  | This will download and install the latest version of Poetry,
app_1  | a dependency and package manager for Python.
app_1  |
app_1  | It will add the `poetry` command to Poetry's bin directory, located at:
app_1  |
app_1  | /root/.local/bin
app_1  |
app_1  | You can uninstall at any time by executing this script with the --uninstall option,
app_1  | and these changes will be reverted.
app_1  |
app_1  | Installing Poetry (https://github.com/python-poetry/poetry.git@)
app_1  | Installing Poetry (https://github.com/python-poetry/poetry.git@): Creating environment
app_1  | Installing Poetry (https://github.com/python-poetry/poetry.git@): Installing Poetry
app_1  | Installing Poetry (https://github.com/python-poetry/poetry.git@): An error occurred. Removing partial environment.
app_1  | Poetry installation failed.
app_1  | See /app/poetry-installer-error-txk2xmfn.log for error logs.

The installation log-


app-1  | Collecting git+https://github.com/python-poetry/poetry.git@
app-1  | ERROR: The URL 'git+https://github.com/python-poetry/poetry.git@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
app-1  |
app-1  | Traceback:
app-1  |
app-1  |   File "<stdin>", line 872, in main
app-1 |   File "<stdin>", line 503, in run
app-1 |   File "<stdin>", line 525, in install
app-1  |   File "<stdin>", line 632, in install_poetry
app-1  |   File "<stdin>", line 340, in pip
app-1  |   File "<stdin>", line 337, in python
app-1  |   File "<stdin>", line 330, in run
app-1  | Collecting git+https://github.com/python-poetry/poetry.git@
app-1  | ERROR: The URL 'git+https://github.com/python-poetry/poetry.git@' has an empty revision (after @) which is not supported. Include a revision after @ or remove @ from the URL.
app-1 |
app-1  | Traceback:
app-1 |
app-1  |   File "<stdin>", line 872, in main
app-1  |   File "<stdin>", line 503, in run
app-1  |   File "<stdin>", line 525, in install
app-1  |   File "<stdin>", line 632, in install_poetry
app-1  |   File "<stdin>", line 340, in pip
app-1  |   File "<stdin>", line 337, in python
app-1 |   File "<stdin>", line 330, in run
app-1 exited with code 2

It seems like the installer is ignoring the git branch that is passed to it.

I’ve tried this with the python3.9 and python 3.10 containers.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
canikocommented, Mar 22, 2022

Created a request on Docker Hub to create poetry-based images, please support!

1reaction
clintonroycommented, Mar 9, 2022

Docker context is different to shell context, you need to use ENV and WORKDIR:

FROM python:3.10
RUN set -xe
RUN curl -sSL https://install.python-poetry.org | python3 - --git https://github.com/python-poetry/poetry.git@master
ENV PATH="/root/.local/bin:$PATH"
RUN poetry --version
RUN poetry new foobar
WORKDIR foobar
RUN poetry add pycowsay
RUN poetry run pycowsay 'Hello world!'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrating Python Poetry with Docker - Stack Overflow
Dependencies are installed directly in the python interpreter of the container. It does not create poetry to create a virtual environment before installing...
Read more >
FastAPI in Containers - Docker
When deploying FastAPI applications a common approach is to build a Linux container image. It's normally done using Docker. You can then deploy...
Read more >
Introduction | Documentation | Poetry - Python dependency ...
Introduction Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on...
Read more >
Deploy Python Lambda functions with container images
Deploy your Python Lambda function code as a container image using an AWS provided base image or the runtime interface client.
Read more >
Efficient Python Docker Image from any Poetry Project
Need to pack your python project into a docker container? Using poetry as a package manager? Then the Dockerfile here below can be...
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