Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry is impossible to install on the python docker images. #4865

Closed
3 tasks done
tedivm opened this issue Dec 5, 2021 · 9 comments
Closed
3 tasks done

Poetry is impossible to install on the python docker images. #4865

tedivm opened this issue Dec 5, 2021 · 9 comments
Labels
kind/bug Something isn't working as expected

Comments

@tedivm
Copy link

tedivm commented Dec 5, 2021

  • 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.

@tedivm tedivm added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 5, 2021
@tedivm tedivm closed this as completed Dec 5, 2021
@tedivm tedivm reopened this Dec 5, 2021
@tedivm
Copy link
Author

tedivm commented Dec 5, 2021

The same error occurs with just-

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

@neersighted
Copy link
Member

neersighted commented Dec 5, 2021

Hi @tedivm! I think more detailed reproduction instructions will be needed to understand what you are trying to do. That being said, I did my best to create a simple reproduction and am unable to replicate what you are experiencing:

printf "
set -xe
curl -sSL https://install.python-poetry.org | python3 - --git https://github.com/python-poetry/poetry.git@master
export PATH="/root/.local/bin:$PATH"
poetry --version
poetry new foobar
pushd foobar
poetry add pycowsay
poetry run pycowsay 'Hello world!'
" | docker run --rm -i --entrypoint bash python:3.10
+ curl -sSL https://install.python-poetry.org
+ python3 - --git https://github.com/python-poetry/poetry.git@master
# 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:

/root/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (https://github.com/python-poetry/poetry.git@master)
Installing Poetry (https://github.com/python-poetry/poetry.git@master): Creating environment
Installing Poetry (https://github.com/python-poetry/poetry.git@master): Installing Poetry
Installing Poetry (https://github.com/python-poetry/poetry.git@master): Creating script
Installing Poetry (https://github.com/python-poetry/poetry.git@master): Done

Poetry (https://github.com/python-poetry/poetry.git@master) is installed now. Great!

To get started you need Poetry's bin directory (/root/.local/bin) in your `PATH`
environment variable.

Add `export PATH="/root/.local/bin:$PATH"` to your shell configuration file.

Alternatively, you can call Poetry explicitly with `/root/.local/bin/poetry`.

You can test that everything is set up by executing:

`poetry --version`

+ export PATH=/root/.local/bin:/home/neersighted/.local/bin
+ PATH=/root/.local/bin:/home/neersighted/.local/bin
+ poetry --version
Poetry (version 1.2.0a2)
+ poetry new foobar
Created package foobar in foobar
/foobar /
+ pushd foobar
+ poetry add pycowsay
Creating virtualenv foobar-lWDpn5M1-py3.10 in /root/.cache/pypoetry/virtualenvs
Using version ^0.0.0.1 for pycowsay

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing pycowsay (0.0.0.1)
+ poetry run pycowsay 'Hello world!'

  ------------
< Hello world! >
  ------------
   \   ^__^
    \  (oo)\_______
       (__)\       )\/\
           ||----w |
           ||     ||

Please try this out on your system and let us know if it works! We'll probably move this to a discussion at that point if it proves not to be a bug in poetry.

@tedivm tedivm closed this as completed Dec 5, 2021
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
@SpangleLabs
Copy link

Hey there, I'm seeing a very similar issue, and I've been struggling against it for a couple days now.

Dockerfile:

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
RUN export PATH="/root/.local/bin:$PATH"
RUN poetry --version
RUN poetry new foobar
RUN pushd foobar
RUN poetry add pycowsay
RUN poetry run pycowsay 'Hello world!'

And fails with:

 => ERROR [ 5/11] RUN poetry --version                                                                    52.6s 
------
 > [ 5/11] RUN poetry --version:
#9 51.65 /bin/sh: 1: poetry: not found
------
executor failed running [/bin/sh -c poetry --version]: exit code: 127

@clintonroy
Copy link
Contributor

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!'

@SpangleLabs
Copy link

That works!
Ahh heck, I was sure I had tried with an ENV line there, and had no luck. Had burnt way too much time on this
Thank you so much!

Though, doesn't work on alpine, not sure why, but happy to accept whatever works at this point

@rahulkp220
Copy link

rahulkp220 commented Jul 5, 2022

Possibly try this, if you are trying to install it via Dockerfile

# install poetry
RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry install --no-dev

@akozyreva
Copy link

Possibly try this, if you are trying to install it via Dockerfile

# install poetry
RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry install --no-dev

According official documentation, it's not recommended to use pip for poetry installation

@mhassan5809
Copy link

mhassan5809 commented Sep 18, 2023

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!'

in my case FROM python:3.10-slim not works but FROM python:3.10 works

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

8 participants