AttributeError on running "poetry install"
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: macOS Mojave, version 10.14.6
- Poetry version: 1.0.5
Issue
Having a pyproject.toml
with the following tool.poetry.dependencies
section:
[tool.poetry.dependencies]
python = "~2.7, >=3.4, <3.8"
Running poetry install
results in AttributeError
:
$ poetry install -vvv
[AttributeError]
EmptyConstraint instance has no attribute 'min'
Traceback (most recent call last):
File "/Users/me/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/Users/me/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/Users/me/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 163, in _do_handle
self._dispatcher.dispatch(PRE_HANDLE, event)
File "/Users/me/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 22, in dispatch
self._do_dispatch(listeners, event_name, event)
File "/Users/me/.poetry/lib/poetry/_vendor/py2.7/clikit/api/event/event_dispatcher.py", line 89, in _do_dispatch
listener(event, event_name, self)
File "/Users/me/.poetry/lib/poetry/console/config/application_config.py", line 86, in set_env
poetry = command.poetry
File "/Users/me/.poetry/lib/poetry/console/commands/command.py", line 10, in poetry
return self.application.poetry
File "/Users/me/.poetry/lib/poetry/console/application.py", line 49, in poetry
self._poetry = Factory().create_poetry(Path.cwd())
File "/Users/me/.poetry/lib/poetry/factory.py", line 90, in create_poetry
package.python_versions = constraint
File "/Users/me/.poetry/lib/poetry/packages/project_package.py", line 45, in python_versions
create_nested_marker('python_version', self._python_constraint)
File "/Users/me/.poetry/lib/poetry/packages/utils/utils.py", line 214, in create_nested_marker
if constraint.min is not None:
However, poetry check
returns no errors:
$ poetry check
All set!
So, I’m making a conclusion that python = "~2.7, >=3.4, <3.8"
is a valid version constraint.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Poetry add <package> returns AttributeError - Stack Overflow
In the end, what worked for me was to reinstall poetry as described in the docs:
Read more >Dependency Management With Python Poetry
The recommended way to install Poetry is by using the official install-poetry script. You can either download and run this Python file ...
Read more >Building "web" container failing during `poetry install` in ...
The python3-buster base image we build on got an update yesterday (2022-02-13) which feels like a pretty suspicious coincidence. The stacktrace shows that...
Read more >Python projects documentation | k8saas documentation
Poetry install error with 'Link' object has no attribute 'is_absolute'. Error messages: • Installing urllib3 (1.26.7): Failed
Read more >AttributeError: 'module' object has no attribute 'main'
Module object has no attribute error: Python. An attribute in Python means some property ... If running Python 3.4 and up, do import...
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
I ran into this bug, too. And yes, it’s caused by pytest-randomly
Work-a-round: pytest-randomly = “!=3.6.0”
But i think poetry should raise a better error messages than this:
Think we should get the package name that caused the error, isn’t it?
@abn Thanks! I didn’t find OR operator in docs.
My point is more about that in described case the
AttributeError: EmptyConstraint instance has no attribute 'min'
is not really helpful andpoetry check
accepts obviously invalid requirement:python = "~2.7, >=3.4, <3.8"
, without failure.