question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jediecommented, Apr 5, 2021

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:

grafik

Think we should get the package name that caused the error, isn’t it?

1reaction
pavdmytcommented, May 4, 2020

@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 and poetry check accepts obviously invalid requirement: python = "~2.7, >=3.4, <3.8", without failure.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found