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

Compatibility with Github actions and Python 3.10 #4056

Closed
2 tasks done
sondrelg opened this issue May 10, 2021 · 10 comments
Closed
2 tasks done

Compatibility with Github actions and Python 3.10 #4056

sondrelg opened this issue May 10, 2021 · 10 comments

Comments

@sondrelg
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Background

Hi!

I maintain this little github action for setting up and configuring Poetry. Since Python 3.10 is on the horizon and the first beta version has just been released we thought it would be nice to take a crack at making the action compatible (see this PR), but we're having some difficulties.

Specifically we're seeing this error:

Traceback (most recent call last):
  File "/home/runner/.poetry/bin/poetry", line 17, in <module>
    from poetry.console import main
  File "/home/runner/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/runner/.poetry/lib/poetry/console/application.py", line 3, in <module>
    from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'

This error seems to be referenced in a number of issues, but generally in relation to a self upgrade or reinstalls (see #553, #3071, #3345). In our case, this looks like it's happening on fresh installs on Python 3.10 specifically.

MVP

We're seeing the error whenever we try to use the get-poetry script in conjunction with Python 3.10.0-beta.1

Here is an example run of the following workflow, where Poetry seemingly installs successfully, but then fails on poetry install:

name: tests

on: pull_request

jobs:
  test-python-310:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: 3.10.0-beta.1
      - run: |
          curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - --yes --version=1.1.6
          echo "$HOME/.poetry/bin" >> $GITHUB_PATH
      - run: poetry install

For context, we saw the exact same errors for the previous alpha versions of Python 3.10.

Do you have any idea what might be causing this?

@HacKanCuBa
Copy link

I have been using Poetry 1.1.4 and 1.1.6 with Python 3.10rc in a pipeline for the last couple of months without issue. I simply used pip install poetry.

But now I changed several things and among others, I'm using the get-poetry.py script and got this same error when running poetry install, which is why I came here. Maybe is that why they're deprecating the script in favour of install-poetry.py? I don't like the new one because it doesn't check any hash and simply does pip install poetry...

In all my tests I used the Debian slim Python Docker image.

I will update this if I get more info on what's going on.

@HacKanCuBa
Copy link

HacKanCuBa commented May 13, 2021

I see that get-poetry.py downloads the .tar.gz file from this repo. Said file doesn't have Python 3.10 under the _vendor directory, which might implicate that not all dependencies are being correctly installed (such as the offending one, cleo).

I also tested the new install-poetry.py script and couldn't even get poetry installed, the binary is nowhere to be found.

@HacKanCuBa
Copy link

I run get-poetry.py under Python 3.10 and at least the following packages end up missing:

  • cleo
  • tomlkit

After pip-installing those, poetry fails again:

root@bbe8f09bc76d:/# $HOME/.poetry/bin/poetry 
Traceback (most recent call last):
  File "/root/.poetry/bin/poetry", line 17, in <module>
    from poetry.console import main
  File "/root/.poetry/lib/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/root/.poetry/lib/poetry/console/application.py", line 7, in <module>
    from .commands.about import AboutCommand
  File "/root/.poetry/lib/poetry/console/commands/__init__.py", line 2, in <module>
    from .add import AddCommand
  File "/root/.poetry/lib/poetry/console/commands/add.py", line 8, in <module>
    from .init import InitCommand
  File "/root/.poetry/lib/poetry/console/commands/init.py", line 16, in <module>
    from poetry.core.pyproject import PyProjectException
ModuleNotFoundError: No module named 'poetry.core'

For the moment, the only viable way I see to install poetry under Python 3.10 is pip install poetry.

@JWCook
Copy link

JWCook commented May 23, 2021

For reference, this was fixed with #3706. The solution is to use the new install-poetry.py bootstrap script rather than get-poetry.py, and the install-poetry GitHub Action has been updated to use this.

@sondrelg
Copy link
Author

Since get-poetry.py is being deprecated and the replacement script seems to do the trick, I'll close this 👍

@HacKanCuBa
Copy link

Does it really work? I tested it too, 20 days ago:

I also tested the new install-poetry.py script and couldn't even get poetry installed, the binary is nowhere to be found.

@sondrelg
Copy link
Author

sondrelg commented Jun 2, 2021

It does seem that way @HacKanCuBa 🙂 See this example run that I found through the last mention above.

@HacKanCuBa
Copy link

HacKanCuBa commented Jun 2, 2021

Awesome, thanks! Gonna try it in while :D 👯

@HacKanCuBa
Copy link

Yup, it does work great! Tried it in latest python:3.10-rc-slim (python@sha256:f5aa74257dc03d74b9810a97d79d2ea01d2ecdb5139390749e506098a7fc2fc3)

br3ndonland added a commit to br3ndonland/inboard that referenced this issue Jul 5, 2021
python-poetry/poetry#3706
python-poetry/poetry#3870
python-poetry/poetry#4056

Poetry has a new install script, added in python-poetry/poetry#3706.
The old get-poetry.py install script is not compatible with Python 3.10,
so the new install-poetry.py script will be used.

Docker builds and GitHub Actions workflows will be updated to use
`POETRY_HOME=/opt/poetry` consistently.

As of Poetry 1.1.7, there may be complications in Docker when using
install-poetry.py without venvs (`POETRY_VIRTUALENVS_CREATE=false`).
While installing dependencies, the following error is frequently seen:

```text
OSError

Could not find a suitable TLS CA certificate bundle, invalid path:
/opt/poetry/venv/lib/python3.9/site-packages/certifi/cacert.pem

at /opt/poetry/venv/lib/python3.9/site-packages/requests/adapters.py:227
in cert_verify
```

Poetry may be incorrectly attempting to read from its virtualenv if it's
not respecting `POETRY_VIRTUALENVS_CREATE` (python-poetry/poetry#3870).
Downstream steps also do not respect `POETRY_VIRTUALENVS_CREATE`, so the
application does not run.
br3ndonland added a commit to br3ndonland/fastenv that referenced this issue Jul 6, 2021
python-poetry/poetry#3706
python-poetry/poetry#3870
python-poetry/poetry#4056

Poetry has a new install script, added in python-poetry/poetry#3706.
The old get-poetry.py install script is not compatible with Python 3.10.
This commit will update the GitHub Actions workflow to use the new
install-poetry.py script, with `POETRY_HOME=/opt/poetry` for consistent
installs independent of user account, and will also update the workflow
to use a virtualenv and run commands with `poetry run` to avoid issues
with `POETRY_VIRTUALENVS_CREATE=false`.

As of Poetry 1.1.7, there may be complications with install-poetry.py
run without venvs (`POETRY_VIRTUALENVS_CREATE=false`). An error is seen:

```text
OSError

Could not find a suitable TLS CA certificate bundle, invalid path:
/opt/poetry/venv/lib/python3.9/site-packages/certifi/cacert.pem

at /opt/poetry/venv/lib/python3.9/site-packages/requests/adapters.py:227
in cert_verify
```

Poetry may be incorrectly attempting to read from its virtualenv if it's
not respecting `POETRY_VIRTUALENVS_CREATE` (python-poetry/poetry#3870).
Downstream steps also do not respect `POETRY_VIRTUALENVS_CREATE`, so the
application does not run. To avoid these issues, `poetry run` can be
prepended to commands to prompt Poetry to use its virtualenv.

Additionally, Poetry errors out with a `JSONDecodeError` when attempting
to install packages with Python 3.10 (python-poetry/poetry#4210). Python
3.10 support will be postponed until Poetry is compatible.
jtc42 pushed a commit to jtc42/fastapi-hypermodel that referenced this issue Oct 31, 2021
@KeenS KeenS mentioned this issue Nov 16, 2021
1 task
Copy link

github-actions bot commented Mar 2, 2024

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 Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants