-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
solver doesn't find correct version of package with a number at the end of the name #6996
Comments
following directions from the extended exception output:
|
This is still missing verbose output as requested by the issue template.
It looks like this is because of an ambiguously named sdist. @dimbleby @radoering PTAL -- is there anything we can do here, other than request the author re-upload correctly named sdists? |
I have tested some other integer-ended packages and it does indeed seem specific to this one. |
It's because the source distribution names are out of spec, but pip does handle that case as it wasn't codified until recent-ish. (and your previous issue was for a solved bug that caused issues with other integer-suffixed packages -- this bug is unique because of the sdist names) |
I can't say I find myself very interested in doing anything with this, but if anyone does then the code to change should be here - that's what's parsing the package version from the filename. Main thing to worry about if making a change would likely be to make sure that the main line modern case - with exactly one hyphen in the filename - is the fast path, then the oddities don't matter so much. |
If anyone comes here, this is a quick fix for poetry.
|
Another possible solution is to add the package from
|
While not optimal, I wonder if this could be a bodge workaround in the CLI tool. It's hacky, but it could work. (Coding on my phone, just assume this is pseudocode): import re
import sys
import subprocess
import toml
from importlib.metadata import version
if re.match(r".*[0-9]+$", package_name):
try:
subprocess.check_call([sys.executable, '-m', 'pip', install', package_name])
except subprocess.CalledProcessError:
# Handle a bad package
print("You done a bad package.")
raise
# Requires Python > 3.8
package_version = version(package_name)
# Update pyproject.toml (I don't do a lot with TOML - this is likely terrible)
with open("pyproject.toml", "rb") as cfg:
project_toml = toml.load(cfg)
project_toml["tool.poetry.dependencies"][package_name] = package_version
with open("pyproject.toml", "w") as cfg:
toml.dump(project_toml, cfg)
# Update poetry's stuff (whatever the equivalent is)
poetry.lock()
poetry.install() I'm doing this all from memory... so don't hate on the bad code... just a concept. |
The workaround of manually installing Unless another workaround is found, this makes it essentially impossible to include any integer-ending package in a Poetry project. |
restating things already in the thread but becoming buried: it is not all integer-ending packages, the bug requires a more specific combination of hyphens and mis-named distributions too eg https://pypi.org/project/iso-639/#files #6996 (comment) points at the code if anyone would like to contribute a fix |
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. |
-vvv
option) and have included the output below.Issue
When installing a package with an integer at the end of the package name, the solver is not finding the correct package. The specific package I am having trouble with is flask-restful-swagger-2. latest at the time of writing is 0.35
adding unbounded:
adding the explicit latest version bound:
manually updating pyproject.toml to
flask-restful-swagger-2 = "^0.35"
and rerunning install:run with -vvv
Incidentally, ^0.20 is the latest of the package flask-restful-swagger (package name doesn't end in
-2
)The text was updated successfully, but these errors were encountered: