Optinal package install (mypy) raising "Could not parse version constraint: <empty>"
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: CentOS 7.
-
Poetry version: 0.12.17
-
Link of a Gist with the contents of your pyproject.toml file: NA
Issue
I have a package that needs running on Python 2 and 3. Therefore, I have
[tool.poetry.dependencies]
python = "^2.7 || ^3.6 || ^3.7"
in my pyproject.toml
file.
I want some dependencies to be only Python 3, mostly for dev work – namely mypy
and black
. Reading the documentation, I found it is best practice to use poetry add …
so that is what I did. However, I got a Could not parse version constraint: <empty>
.
What am I doing wrong?
Could it be another manifestation of bug #1480?
usignals-py3.7(poetry ↑2|+3); poetry add -v -D --python ">=3.6" --optional mypy
Using virtualenv: /home/usr/.cache/pypoetry/virtualenvs/usignals-py3.7
Using version ^0.740.0 for mypy
Updating dependencies
Resolving dependencies... (0.9s)
[ValueError]
Could not parse version constraint: <empty>
Exception trace:
/home/usr/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/usr/.poetry/lib/poetry/console/application.py in do_run() at line 88
return super(Application, self).do_run(i, o)
/home/usr/.poetry/lib/poetry/_vendor/py3.7/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/usr/.poetry/lib/poetry/console/commands/command.py in run() at line 77
return super(BaseCommand, self).run(i, o)
/home/usr/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/usr/.poetry/lib/poetry/_vendor/py3.7/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/usr/.poetry/lib/poetry/console/commands/add.py in handle() at line 139
status = installer.run()
/home/usr/.poetry/lib/poetry/installation/installer.py in run() at line 73
self._do_install(local_repo)
/home/usr/.poetry/lib/poetry/installation/installer.py in _do_install() at line 165
ops = solver.solve(use_latest=self._whitelist)
/home/usr/.poetry/lib/poetry/puzzle/solver.py in solve() at line 38
packages, depths = self._solve(use_latest=use_latest)
/home/usr/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 177
e.constraints, use_latest=use_latest
/home/usr/.poetry/lib/poetry/puzzle/solver.py in solve_in_compatibility_mode() at line 144
_packages, _depths = self._solve(use_latest=use_latest)
/home/usr/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 171
self._package, self._provider, locked=locked, use_latest=use_latest
/home/usr/.poetry/lib/poetry/mixology/__init__.py in resolve_version() at line 7
return solver.solve()
/home/usr/.poetry/lib/poetry/mixology/version_solver.py in solve() at line 79
next = self._choose_package_version()
/home/usr/.poetry/lib/poetry/mixology/version_solver.py in _choose_package_version() at line 377
version = self._provider.complete_package(version)
/home/usr/.poetry/lib/poetry/puzzle/provider.py in complete_package() at line 592
package.dependency.python_constraint
/home/usr/.poetry/lib/poetry/packages/dependency.py in transitive_python_versions() at line 109
self._transitive_python_constraint = parse_constraint(value)
/home/usr/.poetry/lib/poetry/semver/__init__.py in parse_constraint() at line 31
constraint_objects.append(parse_single_constraint(and_constraints[0]))
/home/usr/.poetry/lib/poetry/semver/__init__.py in parse_single_constraint() at line 164
raise ValueError("Could not parse version constraint: {}".format(constraint))
add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I am having a similar problem with
pytest-mock
packageI found out that it adds an entry about
typing
module in thepoetry.lock
, and it seems to be the root cause with an invalid marker fieldmarker = "<empty>"
a reference toml file
"mypy"
is not a valid version constraint. Poetry is telling you that you are feeding it a meaningless input. If you’re confused by this, please start a Discussion or reach out on Github instead of commenting on a resolved issue.