typer-cli: Typer-cli (0.0.12) depends on typer (>=0.3.0,<0.4.0), so typer 0.4.0 AND typer-cli 0.0.12 are incompatible
I get this when I poetry update on my system:
$ poetry update
Updating dependencies
Resolving dependencies... (0.0s)
SolverProblemError
Because typer-cli (0.0.12) depends on typer (>=0.3.0,<0.4.0)
and cb depends on typer (0.4.0), typer-cli is forbidden.
So, because cb depends on typer-cli (0.0.12), version solving failed.
at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 40
- Comments: 18 (1 by maintainers)
+1 @tiangolo it would be great to get a fix for this! 🙏
ATM I can’t install
typer-cliwithin mytyperproject. When installingtyper-cliglobally, leaving alone the dependencies issues, it’s not possible to generate docs.@tiangolo ?
+1 Still an ongoing issue after typer 0.6
Thanks for the discussion, everyone! ☕ This should be solved by Typer-CLI
0.0.13, just released. 🎉I’ll try to get the other contributors attention…
@juanmapf97 @ovezovs 🙏
This is just a note that simply changing the version specification in
pyproject.tomlwill not completely solve the problem.There is an implicit dependency on click 7.x, which is satisfied because it is also a dependency of typer 0.3.x:
typer_cli/main.pyimportsclick._bashcomplete.get_choicesandclick._bashcomplete.resolve_ctx. It also monkey-patchesclick._bashcomplete.get_choices.This part will have to be rewritten in
typer-clito support click 8.x as was done for typer (https://github.com/tiangolo/typer/commit/b97298181bd2a932be70ba417b9a712294fa327c).@tiangolo Hey there! 😃 Still having issue with installing
typerandtyper-cliwithpoetry.This is how my current
pyproject.tomllooks like:[tool.poetry] name = “cumana” version = “0.1.0” description = “” authors = [“dpren90 dario@sibill.it”] readme = “README.md”
[tool.poetry.dependencies] python = “^3.11” spacy = “^3.6.1” it-core-news-lg = {url = “https://github.com/explosion/spacy-models/releases/download/it_core_news_lg-3.6.0/it_core_news_lg-3.6.0.tar.gz”} fastapi = “^0.103.1” uvicorn = “^0.23.2” typer = {extras = [“all”], version = “^0.9.0”} pandas = “^2.1.0” pydantic = “^2.3.0”
[tool.poetry.group.dev.dependencies] pytest = “^7.4.2” black = “^23.7.0” mypy = “^1.5.1”
[build-system] requires = [“poetry-core”] build-backend = “poetry.core.masonry.api”
Still - when running
poetry add typer-cli,I get the following:Updating dependencies Resolving dependencies… (0.0s)
Because no versions of typer-cli match >0.0.13,<0.0.14 and typer-cli (0.0.13) depends on typer (>=0.4.0,<=0.7.0), typer-cli (>=0.0.13,<0.0.14) requires typer (>=0.4.0,<=0.7.0). And because typer (0.9.0) depends on typer (0.9.0) and no versions of typer match >0.9.0,<0.10.0, typer-cli (>=0.0.13,<0.0.14) is incompatible with typer (>=0.9.0,<0.10.0). So, because cumana depends on both typer (^0.9.0) and typer-cli (^0.0.13), version solving failed.
Any ide why this could fail? Even
poetry add typer-cli@latestdoesn’t make the trick.https://github.com/tiangolo/typer-cli/pull/67#issuecomment-1271983950
Hi @tiangolo ! I have the same issue.
typer-clican’t be installed with an up to datetyperversion.TL;DR - don’t try this
A project can run into this problem if it depends on both
typer(project libs) andtyper-cli(dev libs). One possibility to avoid this conflict is to use the pipx project to installtyper-clias a global utility that is independent of the project dependency tree. This might avoid “contaminating” the project virtual env with too many utility libraries that all have their own dependency tree issues. (This approach also works well for poetry installations.)Of course, this makes the project less portable. There are trade-offs to consider for this approach, esp. if any CI/CD systems also depend on the
typer-clias a dev lib.Also, as I discovered, after a
poetry remove -D typer-cliand then usingtyperto build CLI docs, this approach does not work great. The problem is thattyperwill import the CLI modules in order to build the CLI docs. When it does so, using a global pipx installation, it is failing to import project libs from the project venv.