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 1.1.2 uses an invalid format when exporting local file dependencies #3189

Closed
2 of 3 tasks
akpircher opened this issue Oct 13, 2020 · 4 comments · Fixed by #3816
Closed
2 of 3 tasks

Poetry 1.1.2 uses an invalid format when exporting local file dependencies #3189

akpircher opened this issue Oct 13, 2020 · 4 comments · Fixed by #3816
Labels
kind/bug Something isn't working as expected

Comments

@akpircher
Copy link

akpircher commented Oct 13, 2020

  • 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

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
...
@akpircher akpircher added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 13, 2020
@eduardofb
Copy link

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?

@akpircher
Copy link
Author

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

@Kruszylo
Copy link

The problem still appears in version 1.1.4

abn pushed a commit that referenced this issue Mar 20, 2021
This change ensures that when exporting `requirements.txt`, local 
direct reference dependencies are exported as uri and not paths.

Resolves: #3189
abn pushed a commit to abn/poetry that referenced this issue Mar 20, 2021
This change ensures that when exporting `requirements.txt`, local 
direct reference dependencies are exported as uri and not paths.

Resolves: python-poetry#3189
kasteph pushed a commit that referenced this issue Mar 22, 2021
This change ensures that when exporting `requirements.txt`, local 
direct reference dependencies are exported as uri and not paths.

Resolves: #3189
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
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants