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.

'EmptyConstraint' object has no attribute 'allows'

See original GitHub issue

Everything was working fine until yesterday, I cleaned up my docker ending up removing all the images, etc. The project was building fine before clean up. Post clean up when I rebuilt the docker image, I started receiving the error:

 Writing lock file
#11 68.00
#11 68.00 [AttributeError]
#11 68.00 'EmptyConstraint' object has no attribute 'allows'
#11 68.00
#11 68.05 Traceback (most recent call last):
#11 68.05   File "/usr/local/lib/python3.8/site-packages/clikit/console_application.py", line 131, in run
#11 68.05     status_code = command.handle(parsed_args, io)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 120, in handle
#11 68.05     status_code = self._do_handle(args, io)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/clikit/api/command/command.py", line 171, in _do_handle
#11 68.05     return getattr(handler, handler_method)(args, io, self)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/cleo/commands/command.py", line 92, in wrap_handle
#11 68.05     return self.handle()
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/console/commands/update.py", line 49, in handle
#11 68.05     return installer.run()
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 74, in run
#11 68.05     self._do_install(local_repo)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 230, in _do_install
#11 68.05     self._filter_operations(ops, local_repo)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/installation/installer.py", line 447, in _filter_operations
#11 68.05     ) or not self._env.is_valid_for_marker(package.marker):
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/utils/env.py", line 808, in is_valid_for_marker
#11 68.05     return marker.validate(self.marker_env)
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/version/markers.py", line 601, in validate
#11 68.05     if m.validate(environment):
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/version/markers.py", line 470, in validate
#11 68.05     if not m.validate(environment):
#11 68.05   File "/usr/local/lib/python3.8/site-packages/poetry/version/markers.py", line 361, in validate
#11 68.05     return self._constraint.allows(self._parser(environment[self._name]))
#11 68.05

Here’s my .toml file:

[tool.poetry]
name = "myproject"
version = "0.1.0"
description = ""
authors = ["abc <abc@mail.in>"]

[tool.poetry.dependencies]
python = "^3.8"
python-dotenv = "^0.17.0"
numpy = ">=1.19.2"
pandas = "^1.2.4"
Flask = "^1.1.2"
Flask-SQLAlchemy = "^2.5.1"
Flask-Migrate = "^2.7.0"
newrelic = "^6.2.0"
python-jose = "^3.2.0"
Flask-JWT = "^0.3.2"
PyMySQL = "^1.0.2"
psycopg2 = "^2.8.6"
toolz = "^0.11.1"
sortedcontainers = "^2.3.0"
sqlalchemy-redshift = "^0.8.2"
boto3 = "^1.17.57"
joblib = "^1.0.1"
xgboost = "^1.4.2"
scikit-learn = "^0.24.2"
redis = "^3.5.3"
celery = {extras = ["redis"], version = "^5.1.0"}

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

And here’s my dockerfile:

FROM tiangolo/uwsgi-nginx-flask:python3.8

LABEL MAINTAINER="test@mail.in>"

ARG APP_DIR=/zest-srv
ARG SERVICE_NAME=service
ARG LOG_DIR_PATH=/var/log/uwsgi

WORKDIR $APP_DIR

RUN apt-get update \
     && apt-get install -y ca-certificates

ARG POETRY_VERSION=1.0.0

## Use this instead
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

RUN pip install poetry==$POETRY_VERSION
RUN poetry --version
COPY poetry.lock pyproject.toml ${APP_DIR}/
RUN poetry update -vvv

# RUN mkdir ${APP_DIR}/lib
# COPY lib/transportstore-0.1.0-py3-none-any.whl ${APP_DIR}/lib/

RUN poetry config virtualenvs.create false \
    && poetry install --no-interaction --no-ansi

Here the debug logs: https://pastebin.com/sbiiDf8Z

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:28
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

28reactions
sdispatercommented, Aug 19, 2021

We have a fix ready on the poetry-core side.

We will make a new release of both poetry-core and poetry as soon as possible (either later today or tomorrow).

23reactions
s3riuscommented, Aug 19, 2021

I faced the same issue. My problem was that I was using SQLAlchemy with version “^1.4”. But yesterday SQLAlchemy released “1.4.23” with platform_machine constraint.

Here’s the link: https://github.com/sqlalchemy/sqlalchemy/blob/4331c1902ae341158b597769f4e4991c0a7d5485/setup.cfg#L43.

My solution was to change SQLAlchemy dependency to:

SQLAlchemy = {version = ">=1.4,<1.4.23", extras = ["mypy"]}
Read more comments on GitHub >

github_iconTop Results From Across the Web

`poetry update` AttributeError: 'EmptyConstraint' object has no ...
I get the same error as others, 'EmptyConstraint' object has no attribute 'allows' and through some trail and error it looks like the...
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 >
'EmptyConstraint' object has no attribute 'min' with pytest and ...
'EmptyConstraint' object has no attribute 'min' with pytest and Python 2.7.
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 >
Sebastián Ramírez on Twitter: "@paulweveritt @sqlalchemy ...
Quick note, installing via poetry fails with: 'EmptyConstraint' object has no attribute 'allows' (Tried filing ticket but couldn't unlock ...
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