poetry: Error when adding package: EmptyConstraint instance has no attribute 'min'
- 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: macOS 10.13.6
- Poetry version: 0.12.3
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/bi1yeu/41b2180afd838560daa0faf68e9c236b
Issue
Hi! This is my first time attempting to use poetry. I created a new empty project with this command:
$ poetry new example
Then, from within the example
directory, I attempt to add the jupyter
package:
$ poetry add jupyter
Using version ^1.0 for jupyter
Updating dependencies
Resolving dependencies... (4.0s)
[AttributeError]
EmptyConstraint instance has no attribute 'min'
add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
Verbose output is contained within the gist linked above. I am able to add other packages without apparent error. Happy to provide additional info.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 29 (7 by maintainers)
I’m experiencing this same issue with Poetry 1.1.4 when trying to install certain packages. I was able to get around the issue following a similar approach that @bnoctis and @agilgur5 detailed above. However, for a more recent vendorized install, the file I had to modify was
~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/packages/dependency.py
(where python3.8 is my active interpreter).Here’s a diff of the modifications I made, hopefully others find this useful:
System: MacOS Poetry: 1.1.4
I had to edit
~/.poetry/lib/poetry/_vendor/py3.8/poetry/core/version/markers.py
and line 281 in the definition of
validate(self, environment)
, added:Flip, tool me good 30 mins to fix it. MacOS M1, Poetry 1.1.5, Python 3.9.2 (darwin) Had to do both those fixes as mentioned above by @glencairn and @bnocti, @agilgur5
Met this issue on Poetry 1.0.3 + Python 3.7.4
https://github.com/python-poetry/poetry/issues/3862 Temporary workaround: pin
pytest-randomly = "3.5.0"
Like @glencairn comment, but this works for me:
System: Ubuntu 20 Poetry: 1.0.1 Python: 2.7
P.S. Iam not sure, but this package was causing an error
backports.functools-lru-cache (1.6.3)
I think there’s been a regression here; I get the same error with 0.12.16:
Encountered this issue with poetry version 1.1.7. In my experience, I can confirm updating to version 1.1.8 resolves this issue.
Thanks, @Ver1Sus! backports.functools-lru-cache was causing problems for me as well and fixating its version to 1.6.1 fixed it.
Tell me, how did you know that the problem was with this particular package? I’m wondering since it might happen again with another package.
Just to avoid the import in my case, I used
not hasattr(self._constraint, "allows")
(Or update to version 1.1.8, it apparently fixed the issue)
I found @dem1tris’s solution to be helpful - I changed
pytest-randomly = "^3.5"
to"3.5.0"
.I’m seeing the same issue as @glencairn identified:
macOs 11.0.1
poetry 1.1.15
python 3.8.7
The patch they identified has fixed my issue.
Can anyone guide me on how to identify the offending package? I think we may need to raise a fresh issue here as it seems like whatever causes this has not been resolved, or resurfaced
@pksol, I’m glad that the solution helped!
I ran
poetry update -vvv
with verbose, and poetry pointed out the problematic package:This is also happening due to a change in pytest-randomly, FWIW.
Same issue here, my poetry debug is