NNPDF / pinecards

Runcards needed to generate PineAPPL grids for NNPDF processes
3 stars 1 forks source link

Problem with poetry #122

Closed cschwan closed 2 years ago

cschwan commented 2 years ago
WARNING: You are using pip version 20.3.3; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Traceback (most recent call last):
  File "./rr", line 113, in <module>
    subprocess.run("poetry install".split())
  File "/usr/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 775, in _init_
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'poetry': 'poetry'

Originally posted by @marcozaro in https://github.com/NNPDF/runcards/issues/121#issuecomment-1010845839

alecandido commented 2 years ago

https://github.com/NNPDF/runcards/blob/70396b76f72502fef1f549dcd450fa92d66fd610/README.md#L16-L19 Is this not enough?

cschwan commented 2 years ago

No, it wasn't.

alecandido commented 2 years ago

Then we need more information. poetry is not available as a package, but ./rr install should have made it available.

So we need him to run:

pip list | grep poetry
./rr install
pip list | grep poetry

And please give even the full output of ./rr install.

cschwan commented 2 years ago

@marcozaro ?

marcozaro commented 2 years ago

pip list | grep poetry poetry-dynamic-versioning 0.13.1

alecandido commented 2 years ago

So no poetry has been installed.

The install command is pretty simple, I don't know what it's going wrong in your case. An easy solution is simply to install poetry yourself (i.e. without script aid): https://python-poetry.org/docs/#installation

Easiest (and maybe poor) solution is:

pip install poetry

or replace pip with pipx or whatever you use to install system/user-wide python packages.

A further explanation and comment

At the moment we provide two profiles documented in the README.md, the developer and the user.

In principle, as you user, you should be supposed to use a released version of runcards. Unfortunately runcards is in early development, so nothing is stable, and there are no release around (even the name of repo, package, and command might change), so the user path is not really available.

In principle, I should debug install, but I'm even considering dropping it: poetry it's pretty popular, and every developer it's supposed to maintain its own environment. I started it because poetry + poetry-dynamic-versioning + pre-commit starts being a bit too many tools, without an automated workflow, but since this is coupled to how developer maintains their environments, it has been a bad choice (use pip vs pipx vs apt, and maybe a wrapping environment, and whatever variation). They should be listed in contributing guidelines, and anyone installs what it's needed, and that's it...

alecandido commented 2 years ago

Feel free to uninstall poetry-dynamic-versioning if it's causing you problems. In principle, you just need to properly tag your grids with runcards version (including commit sha if dirty).

marcozaro commented 2 years ago

Hi, so pip3 install poetry gives a lot of things, and ends with...

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. dunamai 1.7.0 requires importlib-metadata>=2.1.1; python_version < "3.8", but you have importlib-metadata 1.7.0 which is incompatible.

probably it is related to the fact that I have python 3.7.3....

Cheers,

Marco

alecandido commented 2 years ago

In principle this is the requirement of poetry 1.1.x:

python = "~2.7 || ^3.5"

https://github.com/python-poetry/poetry/blob/43943ba62f2eb7ea78687704bb5cef930cb830d5/pyproject.toml#L25

while on master it is:

python = "^3.6"

https://github.com/python-poetry/poetry/blob/ecb030e1f0b7c13cc11971f00ee5012e82a892bc/pyproject.toml#L35

alecandido commented 2 years ago

Sorry to have done it in two steps, but try using the suggested installer via curl (I amended the former comment, maybe later than you read it :disappointed:)

cschwan commented 2 years ago

@marcozaro if I read your error message properly, importlib-metadata should be upgraded. Does

pip install -U importlib-metadata

do the trick?

alecandido commented 2 years ago

It's not my error message, that is coming directly from pip.

Poetry recommended installation method (from website) is:

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

(actually website say to run with python, added the 3 myself to be sure)