You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
Linux Mint 20.1:
Poetry version 1.1.8:
Link of a Gist with the contents of your pyproject.toml file:
Issue
When specifying the dependencies tensorflow and black = "*", poetry doesn't install the correct version of typing_extensions for black which causes an error when running black.
To reproduce, type in terminal:
conda create python=3.9 --name poetry-demo
conda activate poetry-demo
poetry new poetry-demo
cd poetry-demo
Edit pyproject.toml's dependency section:
[tool.poetry.dependencies]
python = "^3.8"
black = "*"
tensorflow = "2.6.0"
Now type in terminal:
poetry install
poetry run black .
The last command results in the following error:
Traceback (most recent call last):
File "/home/lukas/anaconda3/envs/poetry-demo/bin/black", line 5, in <module>
from black import patched_main
File "/home/lukas/anaconda3/envs/poetry-demo/lib/python3.9/site-packages/black/__init__.py", line 48, in <module>
from black.files import find_project_root, find_pyproject_toml, parse_pyproject_toml
File "/home/lukas/anaconda3/envs/poetry-demo/lib/python3.9/site-packages/black/files.py", line 26, in <module>
from black.handle_ipynb_magics import jupyter_dependencies_are_installed
File "/home/lukas/anaconda3/envs/poetry-demo/lib/python3.9/site-packages/black/handle_ipynb_magics.py", line 15, in <module>
from typing_extensions import TypeGuard
ImportError: cannot import name 'TypeGuard' from 'typing_extensions' (/home/lukas/anaconda3/envs/poetry-demo/lib/python3.9/site-packages/typing_extensions.py)
This happens because poetry installs black 21.9b0 and typing_extensions 3.7.4.3 although black 21.9b0 requires typing_extensions 3.10.0.0.
Workaround
This issue doesn't occur when the black version is specified to e.g. 21.7b0.
Expected behaviour
The above command sequence should fail early in poetry install instead of the cryptic error when running black. If I change the dependency in pyproject.toml to black "21.9b0", I get the expected behaviour. poetry install fails with:
SolverProblemError
Because tensorflow (2.6.0) depends on typing-extensions (>=3.7.4,<3.8.0)
and black (21.9b0) depends on typing-extensions (>=3.10.0.0), tensorflow (2.6.0) is incompatible with black (21.9b0).
So, because poetry-demo depends on both black (21.9b0) and tensorflow (2.6.0), version solving failed.
This error should also be reported in the described issue above when I specifiy black = "*".
Or even better, poetry should simply install black 21.7b0 which is compatible with the tensorflow requirement.
The text was updated successfully, but these errors were encountered:
"typing_extensions>=3.10.0.0",
# 3.10.0.1 is broken on at least Python 3.10,
# https://github.com/python/typing/issues/865
"typing_extensions!=3.10.0.1; python_version >= '3.10'",
The first entry applies to all python versions (including >= 3.10), the second entry adds an additional requirement for python 3.10 and above. At least, this seems to be the intention of the author and pip handles it that way: Only the first entry applies for python < 3.10 and both entries apply for python >= 3.10.
However, examining the resulting poetry.lock file, there is an entry for black 21.9b0 containing only the second requirement for typing_extensions. In my understanding, there should also be two entries (for the different python versions) in the lock file.
-vvv
option).Issue
When specifying the dependencies
tensorflow
andblack = "*"
, poetry doesn't install the correct version oftyping_extensions
forblack
which causes an error when runningblack
.To reproduce, type in terminal:
Edit
pyproject.toml
's dependency section:Now type in terminal:
The last command results in the following error:
This happens because poetry installs
black 21.9b0
andtyping_extensions 3.7.4.3
althoughblack 21.9b0
requirestyping_extensions 3.10.0.0
.Workaround
This issue doesn't occur when the black version is specified to e.g.
21.7b0
.Expected behaviour
The above command sequence should fail early in
poetry install
instead of the cryptic error when runningblack
. If I change the dependency inpyproject.toml
toblack "21.9b0"
, I get the expected behaviour.poetry install
fails with:This error should also be reported in the described issue above when I specifiy
black = "*"
.Or even better, poetry should simply install
black 21.7b0
which is compatible with thetensorflow
requirement.The text was updated successfully, but these errors were encountered: