poetry
poetry copied to clipboard
solver doesn't find correct version of package with a number at the end of the name
- Poetry version: 1.2.2
- Python version: 3.8.10
- OS version and name: Ubuntu 20.04
- pyproject.toml: https://gist.github.com/samthurston/e51111ba019028328a0a79087988fd94
- [ x] I am on the latest stable Poetry version, installed using a recommended method.
- [ x] I have searched the issues of this repo and believe that this is not a duplicate.
- [ x] I have consulted the FAQ and blog for any relevant entries or release notes.
- [x ] If an exception occurs when executing a command, I executed it again in debug mode (
-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:
$ poetry add flask-restful-swagger-2
Using version ^0.20 for flask-restful-swagger-2
Updating dependencies
Resolving dependencies... (548.9s)
Writing lock file
Package operations: 13 installs, 0 updates, 0 removals
• Installing markupsafe (2.1.1)
• Installing zipp (3.10.0)
• Installing click (8.1.3)
• Installing importlib-metadata (5.0.0)
• Installing itsdangerous (2.1.2)
• Installing jinja2 (3.1.2)
• Installing werkzeug (2.2.2)
• Installing aniso8601 (9.0.1)
• Installing flask (2.2.2)
• Installing pytz (2022.6)
• Installing six (1.16.0)
• Installing flask-restful (0.3.9)
• Installing flask-restful-swagger-2 (0.20)
adding the explicit latest version bound:
$ poetry add [email protected]
Could not find a matching version of package flask-restful-swagger-2
manually updating pyproject.toml to flask-restful-swagger-2 = "^0.35"
and rerunning install:
Installing dependencies from lock file
Warning: poetry.lock is not consistent with pyproject.toml. You may be getting improper dependencies. Run `poetry lock [--no-update]` to fix it.
Because poetry-test depends on flask-restful-swagger-2 (^0.35) which doesn't match any versions, version solving failed.
run with -vvv
$ poetry install -vvv
Loading configuration file /home/sam/.config/pypoetry/config.toml
Using virtualenv: /home/sam/.cache/pypoetry/virtualenvs/poetry-test-yR2o0HPF-py3.8
Project environment contains an empty path in sys_path, ignoring.
Installing dependencies from lock file
Warning: poetry.lock is not consistent with pyproject.toml. You may be getting improper dependencies. Run `poetry lock [--no-update]` to fix it.
Finding the necessary packages for the current system
Source (poetry-repo): 0 packages found for flask-restful-swagger-2 0.35
Falling back to installed packages to discover metadata for flask-restful-swagger-2
Found 0 compatible packages for flask-restful-swagger-2
Stack trace:
4 ~/.local/lib/python3.8/site-packages/poetry/puzzle/solver.py:151 in _solve
149│
150│ try:
→ 151│ result = resolve_version(
152│ self._package, self._provider, locked=locked, use_latest=use_latest
153│ )
3 ~/.local/lib/python3.8/site-packages/poetry/mixology/__init__.py:24 in resolve_version
22│ solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
23│
→ 24│ return solver.solve()
25│
2 ~/.local/lib/python3.8/site-packages/poetry/mixology/version_solver.py:126 in solve
124│ next: str | None = self._root.name
125│ while next is not None:
→ 126│ self._propagate(next)
127│ next = self._choose_package_version()
128│
1 ~/.local/lib/python3.8/site-packages/poetry/mixology/version_solver.py:165 in _propagate
163│ # where that incompatibility will allow us to derive new assignments
164│ # that avoid the conflict.
→ 165│ root_cause = self._resolve_conflict(incompatibility)
166│
167│ # Back jumping erases all the assignments we did at the previous
SolveFailure
Because poetry-test depends on flask-restful-swagger-2 (0.35) which doesn't match any versions, version solving failed.
at ~/.local/lib/python3.8/site-packages/poetry/mixology/version_solver.py:364 in _resolve_conflict
360│ )
361│ self._log(f'! which is caused by "{most_recent_satisfier.cause}"')
362│ self._log(f"! thus: {incompatibility}")
363│
→ 364│ raise SolveFailure(incompatibility)
365│
366│ def _choose_package_version(self) -> str | None:
367│ """
368│ Tries to select a version of a required package.
The following error occurred when trying to handle this error:
Stack trace:
11 ~/.local/lib/python3.8/site-packages/cleo/application.py:329 in run
327│
328│ try:
→ 329│ exit_code = self._run(io)
330│ except Exception as e:
331│ if not self._catch_exceptions:
10 ~/.local/lib/python3.8/site-packages/poetry/console/application.py:185 in _run
183│ self._load_plugins(io)
184│
→ 185│ exit_code: int = super()._run(io)
186│ return exit_code
187│
9 ~/.local/lib/python3.8/site-packages/cleo/application.py:423 in _run
421│ io.input.set_stream(stream)
422│
→ 423│ exit_code = self._run_command(command, io)
424│ self._running_command = None
425│
8 ~/.local/lib/python3.8/site-packages/cleo/application.py:465 in _run_command
463│
464│ if error is not None:
→ 465│ raise error
466│
467│ return event.exit_code
7 ~/.local/lib/python3.8/site-packages/cleo/application.py:449 in _run_command
447│
448│ if event.command_should_run():
→ 449│ exit_code = command.run(io)
450│ else:
451│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
6 ~/.local/lib/python3.8/site-packages/cleo/commands/base_command.py:119 in run
117│ io.input.validate()
118│
→ 119│ status_code = self.execute(io)
120│
121│ if status_code is None:
5 ~/.local/lib/python3.8/site-packages/cleo/commands/command.py:83 in execute
81│
82│ try:
→ 83│ return self.handle()
84│ except KeyboardInterrupt:
85│ return 1
4 ~/.local/lib/python3.8/site-packages/poetry/console/commands/install.py:146 in handle
144│ self.installer.verbose(self.io.is_verbose())
145│
→ 146│ return_code = self.installer.run()
147│
148│ if return_code != 0:
3 ~/.local/lib/python3.8/site-packages/poetry/installation/installer.py:115 in run
113│ self._execute_operations = False
114│
→ 115│ return self._do_install()
116│
117│ def dry_run(self, dry_run: bool = True) -> Installer:
2 ~/.local/lib/python3.8/site-packages/poetry/installation/installer.py:321 in _do_install
319│
320│ with solver.use_environment(self._env):
→ 321│ ops = solver.solve(use_latest=self._whitelist).calculate_operations(
322│ with_uninstalls=self._requires_synchronization,
323│ synchronize=self._requires_synchronization,
1 ~/.local/lib/python3.8/site-packages/poetry/puzzle/solver.py:73 in solve
71│ with self._provider.progress():
72│ start = time.time()
→ 73│ packages, depths = self._solve(use_latest=use_latest)
74│ end = time.time()
75│
SolverProblemError
Because poetry-test depends on flask-restful-swagger-2 (0.35) which doesn't match any versions, version solving failed.
at ~/.local/lib/python3.8/site-packages/poetry/puzzle/solver.py:159 in _solve
155│ packages = result.packages
156│ except OverrideNeeded as e:
157│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
158│ except SolveFailure as e:
→ 159│ raise SolverProblemError(e)
160│
161│ combined_nodes = depth_first_search(PackageNode(self._package, packages))
162│ results = dict(aggregate_package_nodes(nodes) for nodes in combined_nodes)
163│
Incidentally, ^0.20 is the latest of the package flask-restful-swagger (package name doesn't end in -2
)
@drasticactions @StephaneDelcroix thoughts?
If this doesn't work in Hot Reload, I imagine it's also broken in a running app. We should check whether this works when changing the bound value in a running app.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
I need to verify it but I think @hartez is on the right track. This feels like something that would be broken regardless of Hot Reload, it's just that it's easy to see because of Hot Reload.
Having said that, it could be a bit of A and bit of B here. We can check and see.
@spadapet you might check this one with your work on x:Name
to see if it solves anything.
Testing this out again:
- If you change either text field from C# they do change directly and don't stomp each other.
- As far as I can see, having not started to debug XET yet, it seems like the reference binding is causing some kind of additional actions to take place that are binding to the wrong control.
CC @etvorun
Talking with @etvorun, he discovered that this is a bug with MAUI, specifically with source info. When binding that property, MAUI is registering the that element back to the original source element, causing it to be treated as if they are one in the same. You can see that through the live visual tree by clicking on the source info link, which links back to the wrong element.
We need to address how source info works with bindable elements bound this way, this is a MAUI bug.
Removed @spadapet from this, I don't believe the x:name issue is related to this.
Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Windows 11 and Android emulator (13.0-API 33) with below Project:
MauiApp1.zip
Please see the screenshot
@tylandercasper Checking this against MAUI net8.0 GA, the source info is returning the correct values and XAML Hot Reload should be functioning correctly for this use case.
https://github.com/drasticactions/MauiRepros/tree/main/SourceInfoCheck
I still need to find which commit fixed this, but my assumptions are changes in XamlC may have caused the correct binding to happen to fix the source info? Can you try and validate this against this project and mine?
Verifying it between net7.0 and net8.0, I believe https://github.com/dotnet/maui/pull/17230 did fix this. It was for a different issue with styles, but it's the exact underlying cause with this one: The source info was wrong. That PR corrected it for styles and also for this.
If you still have issues with this, please file a new issue.