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: command not found fix #90

Closed

Conversation

fritz-astronomer
Copy link

Attempting a fix for poetry: command not found. #89

My logs were:

$GITHUB_ACTION_PATH/main.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.6.15/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.6.15/x64/lib
    VERSION: 1.2.0
    VIRTUALENVS_CREATE: true
    VIRTUALENVS_IN_PROJECT: true
    VIRTUALENVS_PATH: {cache-dir}/virtualenvs
    INSTALLER_PARALLEL: true
    INSTALLATION_ARGUMENTS: 

Setting Poetry installation path as /home/runner/.local/

Installing Poetry 👷

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/runner/.local/bin

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

Installing Poetry (1.2.0)
Installing Poetry (1.2.0): Creating environment
Installing Poetry (1.2.0): Installing Poetry
Installing Poetry (1.2.0): Creating script
Installing Poetry (1.2.0): Done

Poetry (1.2.0) is installed now. Great!

You can test that everything is set up by executing:

`poetry --version`

/home/runner/work/_actions/snok/install-poetry/v1.3.1/main.sh: line 33: poetry: command not found
/home/runner/work/_actions/snok/install-poetry/v1.3.1/main.sh: line 34: poetry: command not found
/home/runner/work/_actions/snok/install-poetry/v1.3.1/main.sh: line 35: poetry: command not found
/home/runner/work/_actions/snok/install-poetry/v1.3.1/main.sh: line 37: poetry: command not found

Installation completed. Configuring settings 🛠

Done ✅

If you are creating a venv in your project, you can activate it by running 'source .venv/bin/activate'. If you're running this in an OS matrix, you can use 'source $VENV' instead, as an OS agnostic option

@sondrelg
Copy link
Member

In this workflow run v1.2.0 seems to install fine: https://github.com/snok/flake8-type-checking/runs/8122396279?check_suite_focus=true

So I understand, what's the difference between this run and yours?

@sondrelg
Copy link
Member

sondrelg commented Aug 31, 2022

@fritz-astronomer
Copy link
Author

fritz-astronomer commented Aug 31, 2022

Given the issue - I could only imagine that your poetry was getting picked up by the $PATH some other way? Or specifically mine wasn't getting picked up by $PATH? Not entirely sure, to be honest


my original project (which was failing)
note: I ran this for Python 3.7, 3.9, and 3.10

    pythonLocation: /opt/hostedtoolcache/Python/3.9.13/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.13/x64/lib
    VERSION: 1.2.0
    VIRTUALENVS_CREATE: true   <--- this seems to be a difference
    VIRTUALENVS_IN_PROJECT: true  <--- this seems to be a difference
    VIRTUALENVS_PATH: {cache-dir}/virtualenvs
    INSTALLER_PARALLEL: true
    INSTALLATION_ARGUMENTS: 

snok/flake8-type-checking

    pythonLocation: /opt/hostedtoolcache/Python/3.8.12/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.12/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.12/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.12/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.12/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.12/x64/lib
    VERSION: latest
    VIRTUALENVS_CREATE: false
    VIRTUALENVS_IN_PROJECT: false
    VIRTUALENVS_PATH: {cache-dir}/virtualenvs
    INSTALLER_PARALLEL: true
    INSTALLATION_ARGUMENTS: 

snok/asgi-correlation-id

    pythonLocation: /opt/hostedtoolcache/Python/3.8.13/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.13/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.13/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.13/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.13/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.13/x64/lib
    VERSION: latest
    VIRTUALENVS_CREATE: false
    VIRTUALENVS_IN_PROJECT: false
    VIRTUALENVS_PATH: {cache-dir}/virtualenvs
    INSTALLER_PARALLEL: true
    INSTALLATION_ARGUMENTS: 

@sondrelg
Copy link
Member

sondrelg commented Aug 31, 2022

I update to use

- uses: snok/install-poetry@v1
  with:
    virtualenvs-create: true
    virtualenvs-in-project: true
    version: latest

in https://github.com/snok/asgi-correlation-id/runs/8123090043?check_suite_focus=true and that also seems to work fine 🤔

Just to be clear, I don't want to be difficult here, but correcting a mistake is often more costly than delaying a fix in my experience, so just want to understand exactly what we're fixing. Any ideas?

Alternatively, do you have time to create a public repo to reproduce the issue?

@fritz-astronomer
Copy link
Author

fritz-astronomer commented Aug 31, 2022

@sondrelg I totally understand - and also even though my fix works, I didn't grok it enough to say EXACTLY why specifying the path to poetry worked as it did. It's even possible that some other combination of fiddling fixed it.

I do have a public repo that you can observe the issues I was having today -

@sondrelg
Copy link
Member

sondrelg commented Aug 31, 2022

We know that there are breaking changes between v1.1 and v1.2 wrt. lockfile parsing. Is it possible that rebuilding the lockfile with a local version of v1.2.0 fixed your issue? Have you seen any issues since?

EDIT: You're making this very easy btw, thanks for being so thorough 👏

@fritz-astronomer
Copy link
Author

fritz-astronomer commented Aug 31, 2022

Is it possible that rebuilding the lockfile with a local version of v1.2.0

Certainly possible. Also removing Python 3.6
It is at the very least odd that it sometimes installed and sometimes didn't, and sometimes had an issue with Python 3.6 and sometimes didn't

@fritz-astronomer fritz-astronomer marked this pull request as draft August 31, 2022 22:38
@sondrelg
Copy link
Member

sondrelg commented Sep 1, 2022

I just ran into this same issue with Python 3.10, so it doesn't seem exclusive to 3.6 after all. Will report back after testing a little.

EDIT: nevermind, I specified version 1.2 which is not permitted. Has to be 1.2.0

@miigotu
Copy link
Collaborator

miigotu commented Sep 1, 2022

Given the issue - I could only imagine that your poetry was getting picked up by the $PATH some other way? Or specifically mine wasn't getting picked up by $PATH? Not entirely sure, to be honest

my original project (which was failing) note: I ran this for Python 3.7, 3.9, and 3.10

    pythonLocation: /opt/hostedtoolcache/Python/3.9.13/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.13/x64/lib
    VERSION: 1.2.0
    VIRTUALENVS_CREATE: true   <--- this seems to be a difference
    VIRTUALENVS_IN_PROJECT: true  <--- this seems to be a difference
    VIRTUALENVS_PATH: {cache-dir}/virtualenvs
    INSTALLER_PARALLEL: true
    INSTALLATION_ARGUMENTS: 

You need to set VIRTUALENVS_PATH to a path in the project if VIRTUALENVS_IN_PROJECT is true. With your failing spec you were telling it to create a virtualenv in the project and then giving it a path outside the project. So either it was creating the virtualenv in the project and then activating one outside the project that did not have poetry, or vice versa.

This should work

VERSION: 1.2.0
VIRTUALENVS_PATH: .venv
VIRTUALENVS_CREATE: true
VIRTUALENVS_IN_PROJECT: true
INSTALLER_PARALLEL: true

@fritz-astronomer
Copy link
Author

fritz-astronomer commented Sep 1, 2022

@sondrelg - I just swapped back to your plugin, so yea, I think the other fixes I did were the solution, not this. Closing this PR

@fritz-astronomer
Copy link
Author

Good insights - thank you @miigotu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants