question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poetry doesn't install the correct dependency according to its supported Python version

See original GitHub issue

Issue

I have a wheel dependency on specific url for many platforms (Linuw/macOS/Windows) and many Python version (3.8, 3.9, 3.10).

Despite the fact I use Python 3.9, when I try poetry install, the python 3.8 version of the wheel is downloaded.

I also tried to:

  • replace python = "^3.8" by python = "^3.9" (same thing);
  • replace python = "~3.8", markers = "platform_system == 'Linux'", by markers = "python_version ~= '3.8' and platform_system == 'Linux'", (same thing).

Maybe related to #5378 or #5205, I don’t think it’s the same issue but I’m not sure.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dimblebycommented, Apr 17, 2022

Not to say that this isn’t a valid bug report

I don’t understand why this isn’t a valid bug report.

Apologies if my double-negative confused you. We are agreeing.

1reaction
kmsquirecommented, Apr 26, 2022

I see a similar problem with something like the following:

package = [
  { platform = "linux", python = "~3.7.0", url = "https://some.url.com/path/to/package-cp37-cp37-linux_x86_64.whl" },
  { platform = "linux", python = "~3.8.0", url = "https://some.url.com/path/to/package-cp38-cp38-linux_x86_64.whl" },
  { platform = "linux", python = "~3.9.0", url = "https://some.url.com/path/to/package-cp39-cp39-linux_x86_64.whl" },
  { platform = "darwin", python = "~3.7.0", url = "https://some.url.com/path/to/package-cp37-cp37-macosx_10_14_x86_64.whl" },
  { platform = "darwin", python = "~3.8.0", url = "https://some.url.com/path/to/package-cp38-cp38-macosx_10_14_x86_64.whl" },
  { platform = "darwin", python = "~3.9.0", url = "https://some.url.com/path/to/package-cp39-cp39-macosx_10_14_x86_64.whl" },
]

In this case, poetry attempts to install only the first URL–if I look at poetry.lock, I see something like

[[package]]
name = "package"
version = "1.2.3"
description = ""
category = "main"
optional = false
python-versions = "*"

[package.source]
type = "url"
url = "https://some.url.com/path/to/package-cp37-cp37-linux_x86_64.whl"

So, poetry only stores a single URL in the lock file, despite there being multiple URLs specified in pyproject.toml

EDIT: The python versions above were incorrect (i.e., previously, it had "~3.7", but it should have been "~3.7.0"). I’ve fixed it now. Unfortunately, that doesn’t fix the behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry doesn't use the correct version of Python - Stack Overflow
The currently activated Python version 2.7.16 is not supported by the project (^3.8). Trying to find and use a compatible version.
Read more >
FAQ | Documentation | Poetry - Python dependency ...
Once a release of your package is published, you cannot tweak its dependencies anymore in case a dependency breaks BC – you have...
Read more >
Managing Python Projects and Dependencies in 2022
First, let's set up pyenv and set our terminal's default Python version to 3.9.0. Install pyenv using homebrew#. brew install pyenv. Install ......
Read more >
Poetry - The Blue Book
You can specify the exact version of a package. This will tell Poetry to install this version and this version only. If other...
Read more >
poetry - PyPI
Poetry helps you declare, manage and install dependencies of Python ... Compatible Python versions python = ">=3.8" # Standard dependency with semver ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found