Poetry: Poetry 1.1.2 uses an invalid format when exporting local file dependencies

Created on 13 Oct 2020  路  2Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] 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

While I see a bunch of new issues for export, I don't see anything specifically for this one, and want to make sure it doesn't get missed.

poetry export for poetry 1.1.2 uses an invalid/deprecated format for local file dependencies, however poetry 1.0.10 does not.
Specifically, it uses the package @ path/to/local/file.whl format, which does not work for pip 20.0.1 or later. Notably, the format did not cause an error when 19.2.3 was installed.

I noticed this bug after updating poetry from 1.0.10 to 1.1.2. Our build process builds a Docker image that pip installs the exported requirements file.

Steps to reproduce:

$ poetry new example
$ cd example/
$ mkdir third_party
$ pip3 wheel --no-deps -w third_party black
$ poetry add third_party/black-20.8b1-py3-none-any.whl
$ poetry export -o requirements.txt
$ poetry shell
$ python -m pip install -U pip==20.*  # for the purpose of the demo
$ pip3 install -r requirements.txt
ERROR: Invalid requirement: 'black @ third_party/black-20.8b1-py3-none-any.whl' (from line 4 of requirements.txt)
Hint: It looks like a path. File 'black @ third_party/black-20.8b1-py3-none-any.whl' does not exist.


Copy-paste-friendly version of steps (no $ or output)

poetry new example
cd example/
mkdir third_party
pip3 wheel --no-deps -w third_party black
poetry add third_party/black-20.8b1-py3-none-any.whl
poetry export -o requirements.txt
poetry shell
python -m pip install -U pip==20.*
pip3 install -r requirements.txt

Actual behavior/output (1.1.0 and 1.1.2)

...
black @ third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...

Expected behavior/output (1.0.10)

...
third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...

PEP 400 expected output

...
black @ file:///third_party/black-20.8b1-py3-none-any.whl \
    --hash=sha256:c0b742cfc8d6f607729d222b90bf3280e2c1332692b3b2520e7da259a5f4f609
...
Bug

Most helpful comment

@eduardofb That seems to be the issue, manually adding file:/// to the front of the path solves it

All 2 comments

Hi. I'm having a very similar issue. According to this PEP 440, the format is right, but when running the command of pip install, it can't find the path correctly. Maybe is missing the file:/// notation?

@eduardofb That seems to be the issue, manually adding file:/// to the front of the path solves it

Was this page helpful?
0 / 5 - 0 ratings