python-poetry / python-poetry/poetry-plugin-export

`poetry export` generates wrong source flags

Open
#219 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
335
Forks
57
Avg merge
1h 23m
Merged PRs (30d)
3

Description

  • Poetry version: 1.5.1
  • Python version: 3.10
  • OS version and name: Ubuntu 20.04.6
  • pyproject.toml:
[tool.poetry]
name = "mypkg"
version = "0.1.0"
description = ""
authors = [""]
readme = "README.md"
packages = []

[tool.poetry.dependencies]
python = "~3.10"
torch-scatter = { version = "2.1.1", source = "pyg-cuda" }
torch-sparse = { version = "0.6.17", source = "pyg-cuda" }


[[tool.poetry.source]]
name = "PyPI"
priority = "primary"


[[tool.poetry.source]]
name = "pyg-cuda"
url = "https://data.pyg.org/whl/torch-2.0.0+cu118.html"
priority = "primary"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

The poetry export command can not distinguish between --extra-index-url and --find-links as their source definitions are the same.
To be specific, when I run poetry export --without-hashes > requirements.txt, this is what it generates:

--extra-index-url https://data.pyg.org/whl/torch-2.0.0+cu118.html

numpy==1.25.0 ; python_version >= "3.10" and python_version < "3.11"
scipy==1.11.1 ; python_version >= "3.10" and python_version < "3.11"
torch-scatter==2.1.1+pt20cu118 ; python_version >= "3.10" and python_version < "3.11"
torch-sparse==0.6.17+pt20cu118 ; python_version >= "3.10" and python_version < "3.11"

Then, pip install -r requirements.txt gives the following error:

ERROR: Could not find a version that satisfies the requirement torch-scatter==2.1.1+pt20cu118 (from versions: 0.3.0, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.1.0, 2.1.1)
ERROR: No matching distribution found for torch-scatter==2.1.1+pt20cu118

This is because the https://data.pyg.org/whl/torch-2.0.0+cu118.html is supposed to be a --find-links url rather than --extra-index-url or --index-url. Apparently, poetry does not tell the difference due to their same definition.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the poetry export --without-hashes reproduction and the provided pyproject.toml; compare the generated requirements.txt source flag with the configured pyg-cuda source. Done means the export distinguishes a find-links source from an extra index and the resulting requirements file installs the listed packages with pip.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.