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.

`poetry update` AttributeError: 'EmptyConstraint' object has no attribute 'allows'

See original GitHub issue
  • OS version and name: Fedora 34
$ cat /etc/fedora-release 
Fedora release 34 (Thirty Four)
  • Poetry version: Poetry version 1.1.6
$ poetry --version
Poetry version 1.1.6
  • Link of a Gist with the contents of your pyproject.toml file: Unpublished software, so if there is a need for this file, I can provide privately.

Issue

I have received this error message:

$ poetry update 
Updating dependencies                                                                                                                                         
Resolving dependencies... (34.4s)                                                                                                                             
                                                                                                                                                              
Writing lock file                                                                                                                                             
                                                                                                                                                              
  AttributeError                                                                                                                                              
                                                                                                                                                              
  'EmptyConstraint' object has no attribute 'allows'                                                                                                          
                                                                                                                                                              
  at ~/.local/lib/python3.9/site-packages/poetry/core/version/markers.py:291 in validate                                                                      
      287│                                                                                                                                                    
      288│         if self._name not in environment:                                                                                                          
      289│             return True                                                                                                                            
      290│                                                                                                                                                    
    → 291│         return self._constraint.allows(self._parser(environment[self._name]))                                                                      
      292│                                                                                                                                                    
      293│     def without_extras(self):  # type: () -> MarkerTypes                                                                                           
      294│         return self.exclude("extra")                                                                                                               
      295│                                                  

I made this change as a workaround:

$ diff -uw ~/.local/lib/python3.9/site-packages/poetry/core/version/markers.py{~,}
--- /home/martin/.local/lib/python3.9/site-packages/poetry/core/version/markers.py~     2021-04-21 11:44:56.085692322 -0400
+++ /home/martin/.local/lib/python3.9/site-packages/poetry/core/version/markers.py      2021-08-19 11:38:17.934769254 -0400
@@ -288,6 +288,9 @@
         if self._name not in environment:
             return True
 
+        if not hasattr(self._constraint, "allows"):
+            return True
+
         return self._constraint.allows(self._parser(environment[self._name]))
 
     def without_extras(self):  # type: () -> MarkerTypes
$ diff -uw ~/.local/lib/python3.9/site-packages/poetry/core/version/markers.py{~,}
--- /home/martin/.local/lib/python3.9/site-packages/poetry/core/version/markers.py~     2021-04-21 11:44:56.085692322 -0400
+++ /home/martin/.local/lib/python3.9/site-packages/poetry/core/version/markers.py      2021-08-19 11:38:17.934769254 -0400
@@ -288,6 +288,9 @@
         if self._name not in environment:
             return True
 
+        if not hasattr(self._constraint, "allows"):
+            return True
+
         return self._constraint.allows(self._parser(environment[self._name]))
 
     def without_extras(self):  # type: () -> MarkerTypes

I gathered some extra debugging information that points to greenlet and sqlalchemy as being involved in the issue: https://gist.github.com/mdengler/7be12f9c481567c7872bc2ea712464b6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:12

github_iconTop GitHub Comments

14reactions
mrtolkiencommented, Aug 26, 2021

I have the same issue with the current preview build, poetry 1.2.0a2

Will there be another preview build that fixes it?

11reactions
elbakramercommented, Aug 19, 2021

Upgrading poetry to 1.1.8 may solve the issue. Check #4402 for for more information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'EmptyConstraint' object has no 'allows' Attribute error fix? - Replit
Updating dependencies. Resolving dependencies... Writing lock file. AttributeError. 'EmptyConstraint' object has no attribute 'allows'.
Read more >
'EmptyConstraint' object has no 'allows' Attribute error fix?
Updating dependencies. Resolving dependencies... Writing lock file. AttributeError. 'EmptyConstraint' object has no attribute 'allows'.
Read more >
Installing SQLAlchemy with Poetry causes an AttributeErrorr
I tried fl_'s answer but poetry self update itself failed for me with an error saying: ModuleNotFoundError: No module named 'poetry.console'.
Read more >
'EmptyConstraint' object has no attribute 'min' with pytest and ...
[x] I am on the latest Poetry version. [x] I have searched the issues of this repo and believe that this is not...
Read more >
Installing SQLAlchemy with Poetry causes an AttributeErrorr
... for SQLAlchemy Updating dependencies Resolving dependencies... (0.1s) AttributeError 'EmptyConstraint' object has no attribute 'allows' ...
Read more >

github_iconTop Related Medium Post

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