Version Parse error
See original GitHub issue-
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). -
OS version and name: All Platforms
-
Poetry version: 1.2.1a
Issue
Python constraints issues happens when installing aiopika with weird python specifications - poetry add aiopika
Stack trace:
3 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/semver/helpers.py:137 in parse_single_constraint
135β
136β try:
β 137β version = Version.parse(version)
138β except ValueError:
139β raise ValueError(
2 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/version/pep440/version.py:134 in parse
132β from poetry.core.version.pep440.parser import parse_pep440
133β
β 134β return parse_pep440(value, cls)
135β
136β def is_prerelease(self) -> bool:
1 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/version/pep440/parser.py:88 in parse_pep440
86β value: str, version_class: Optional[Type["PEP440Version"]] = None
87β ) -> "PEP440Version":
β 88β return PEP440Parser.parse(value, version_class)
89β
InvalidVersion
Invalid PEP 440 version: '3.5.'
at ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/version/pep440/parser.py:67 in parse
63β @classmethod
64β def parse(cls, value: str, version_class: Optional[Type["PEP440Version"]] = None):
65β match = cls._regex.search(value) if value else None
66β if not match:
β 67β raise InvalidVersion(f"Invalid PEP 440 version: '{value}'")
68β
69β if version_class is None:
70β from poetry.core.version.pep440.version import PEP440Version
71β
The following error occurred when trying to handle this error:
Stack trace:
21 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:314 in run
312β
313β try:
β 314β exit_code = self._run(io)
315β except Exception as e:
316β if not self._catch_exceptions:
20 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/console/application.py:167 in _run
165β self._load_plugins(io)
166β
β 167β return super()._run(io)
168β
169β def _configure_io(self, io: IO) -> None:
19 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:409 in _run
407β io.set_input(ArgvInput(argv))
408β
β 409β exit_code = self._run_command(command, io)
410β self._running_command = None
411β
18 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:451 in _run_command
449β
450β if error is not None:
β 451β raise error
452β
453β return event.exit_code
17 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/application.py:435 in _run_command
433β
434β if event.command_should_run():
β 435β exit_code = command.run(io)
436β else:
437β exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
16 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/base_command.py:118 in run
116β io.input.validate()
117β
β 118β status_code = self.execute(io)
119β
120β if status_code is None:
15 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/cleo/commands/command.py:85 in execute
83β
84β try:
β 85β return self.handle()
86β except KeyboardInterrupt:
87β return 1
14 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/console/commands/add.py:189 in handle
187β self._installer.whitelist([r["name"] for r in requirements])
188β
β 189β status = self._installer.run()
190β except BaseException:
191β # Using BaseException here as some exceptions, eg: KeyboardInterrupt, do not inherit from Exception
13 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/installer.py:112 in run
110β local_repo = Repository()
111β
β 112β return self._do_install(local_repo)
113β
114β def dry_run(self, dry_run: bool = True) -> "Installer":
12 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/installer.py:252 in _do_install
250β )
251β
β 252β ops = solver.solve(use_latest=self._whitelist)
253β else:
254β self._io.write_line("Installing dependencies from lock file")
11 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:99 in solve
97β with self._provider.progress():
98β start = time.time()
β 99β packages, depths = self._solve(use_latest=use_latest)
100β end = time.time()
101β
10 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:270 in _solve
268β
269β try:
β 270β result = resolve_version(
271β self._package, self._provider, locked=locked, use_latest=use_latest
272β )
9 ~/Library/Application Support/pypoetry/venv/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β
8 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/mixology/version_solver.py:82 in solve
80β while next is not None:
81β self._propagate(next)
β 82β next = self._choose_package_version()
83β
84β return self._result()
7 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/mixology/version_solver.py:394 in _choose_package_version
392β version = locked
393β
β 394β version = self._provider.complete_package(version)
395β
396β conflict = False
6 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/puzzle/provider.py:445 in complete_package
443β package = DependencyPackage(
444β package.dependency,
β 445β self._pool.package(
446β package.name,
447β package.version.text,
5 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/repositories/pool.py:143 in package
141β for idx, repo in enumerate(self._repositories):
142β try:
β 143β package = repo.package(name, version, extras=extras)
144β except PackageNotFound:
145β continue
4 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/repositories/pypi_repository.py:165 in package
163β extras: (Union[list, None]) = None,
164β ) -> Package:
β 165β return self.get_release_info(name, version).to_package(name=name, extras=extras)
166β
167β def search(self, query: str) -> List[Package]:
3 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/inspection/info.py:151 in to_package
149β package.description = self.summary
150β package.root_dir = root_dir
β 151β package.python_versions = self.requires_python or "*"
152β package.files = self.files
153β
2 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/packages/package.py:233 in python_versions
231β def python_versions(self, value: str) -> None:
232β self._python_versions = value
β 233β self._python_constraint = parse_constraint(value)
234β self._python_marker = parse_marker(
235β create_nested_marker("python_version", self._python_constraint)
1 ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/semver/helpers.py:33 in parse_constraint
31β if len(and_constraints) > 1:
32β for constraint in and_constraints:
β 33β constraint_objects.append(parse_single_constraint(constraint))
34β else:
35β constraint_objects.append(parse_single_constraint(and_constraints[0]))
ValueError
Could not parse version constraint: >3.5.*
at ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/core/semver/helpers.py:139 in parse_single_constraint
135β
136β try:
137β version = Version.parse(version)
138β except ValueError:
β 139β raise ValueError(
140β "Could not parse version constraint: {}".format(constraint)
141β )
142β
143β if op == "<":
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
6 Methods to Fix Parse Error on Your Android Device - MiniTool
Solution 1: Update Android. Perhaps, the app is not compatible with your old Android OS. Then, you can update your Android to the...
Read more >How to Fix Parse Error in Android: Top 9 Ways - WeTheGeek
This will help you to resolve parse error in Android. To update your Android OS version, go to Settings > About Phone >...
Read more >How to fix βProblem parsing the package errorβ in Android?
1. Go to settings on your device Β· 2. Scroll down & Click on Applications Β· 3. Check the box of βUnknown sources...
Read more >[Solved] How to Fix There Was A Problem Parsing the Package
Six Fixes on Parse Error on Android Β· Fix 1: Enable "Allow installation of apps from unknown sources" Β· Fix 2: Turn on...
Read more >How to Fix βThere Was a Problem Parsing the Packageβ on ...
Redownload the APK if You Have a Corrupted APK File Β· Download the APK From Another Source Β· Update Your Android Version to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@finswimmer can we consider maybe adding an ignore flag ? or being less strict with a warning period? This change is ofc good but it causes real issues that restricts many developers from updating to the new poetry version.
@finswimmer - seconding the above comment. While being more strict with versioning is great for the entirety of the python community, it is going to make the new release of poetry unusable in many circumstances as some python packages will become unusable.
I ran into this issue with
yamllint
defining their python version requirement as>=3.5.*
.Poetry should try to make an assumption in cases like this but log a waning about potential issues. Ideally, it would also provide a link to get more info about what is incorrect, why its incorrect, and how to fix it so that poetry users can submit PRs to slowly resolve these issue across the board.
Something that I would like to see in the next prerelease of poetry (if it has not been done already) is a better error when this issue is encountered. Right now, if I start using poetry 1.2.0a1 after using 1.1.6, it will result in the
ValueError
and show what version specification is incorrect but it does not show what package it belongs to. I just had to go through andpoetry add <package>
each of my projectβs dependencies to be able to find which one needed to be fixed.