Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError unhashable type: 'Integer' installing dependencies using Poetry 1.5.1 #8243

Closed
4 tasks done
johnthagen opened this issue Jul 27, 2023 · 19 comments
Closed
4 tasks done
Labels
kind/bug Something isn't working as expected status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@johnthagen
Copy link
Contributor

johnthagen commented Jul 27, 2023

  • Poetry version: 1.5.1
  • Python version: 3.11
  • OS version and name: python:3.11-slim-bullseye Docker image
  • pyproject.toml:
[tool.poetry.dependencies]
python = "^3.10, <3.12"

typing_extensions = "*"
fastapi = "*"
uvicorn = { version = "*", extras = ["standard"] }
uvloop = { version = "*", markers = "sys_platform != 'win32'" }
psutil = "*"
httpx = ">=0.15.4, <0.24.0"
attrs = ">=21.3.0"
python-dateutil = "^2.8.0"
imageio = "*"
numpy = "*"
opencv-python-headless = ">4.5, <4.6"
Pillow = "*"
scipy = "*"
scikit-image = "*"
pydantic = "*"
pandas = "*"
tflite-runtime-nightly = { version = "*", markers = "sys_platform == 'linux'" }
tensorflow-macos = { version = "2.12.0", markers = "sys_platform == 'darwin'" }
tensorflow-cpu = { version = "*", markers = "sys_platform != 'linux' and sys_platform != 'darwin'" }
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

As of today, installing Poetry 1.5.1 and running poetry install in an python:3.11-slim-bullseye Docker image build started throwing an exception.

FROM python:3.11-slim-bullseye

ENV POETRY_VERSION 1.5.1

ENV WORKDIR /src

WORKDIR ${WORKDIR}

RUN apt-get update && apt-get install -y \
    python3-dev \
    gcc \
 && rm -rf /var/lib/apt/lists/*

RUN pip install "poetry==${POETRY_VERSION}"

ENV VIRTUAL_ENV /opt/venv
RUN python -m venv ${VIRTUAL_ENV}
ENV PATH "${VIRTUAL_ENV}/bin:${PATH}"

COPY pyproject.toml poetry.lock ./
RUN poetry config installer.max-workers 4 && \
    poetry install --only main --no-root

Error output:

#16 [processing_server python_builder  7/12] RUN poetry config installer.max-workers 4 &&     poetry install --only main --no-root
#16 1.038 Installing dependencies from lock file
#16 2.158 
#16 2.158 Package operations: 39 installs, 0 updates, 0 removals
#16 2.158 
#16 2.159   • Installing idna (3.4)
#16 2.159   • Installing sniffio (1.3.0)
#16 2.415 
#16 2.415   TypeError
#16 2.415 
#16 2.415   unhashable type: 'Integer'
#16 2.415 
#16 2.415   at /usr/local/lib/python3.11/site-packages/urllib3/_collections.py:57 in __getitem__
#16 2.429        53│ 
#16 2.429        54│     def __getitem__(self, key):
#16 2.429        55│         # Re-insert the item, moving it to the end of the eviction line.
#16 2.429        56│         with self.lock:
#16 2.429     →  57│             item = self._container.pop(key)
#16 2.429        58│             self._container[key] = item
#16 2.429        59│             return item
#16 2.429        60│ 
#16 2.429        61│     def __setitem__(self, key, value):
#16 2.429 
#16 2.432 
#16 2.432   TypeError
#16 2.432 
#16 2.432   unhashable type: 'Integer'
#16 2.432 
#16 2.432   at /usr/local/lib/python3.11/site-packages/urllib3/_collections.py:57 in __getitem__
#16 2.441        53│ 
#16 2.441        54│     def __getitem__(self, key):
#16 2.441        55│         # Re-insert the item, moving it to the end of the eviction line.
#16 2.441        56│         with self.lock:
#16 2.441     →  57│             item = self._container.pop(key)
#16 2.441        58│             self._container[key] = item
#16 2.441        59│             return item
#16 2.441        60│ 
#16 2.441        61│     def __setitem__(self, key, value):
#16 2.441 
#16 ERROR: process "/bin/sh -c poetry config installer.max-workers 4 &&     poetry install --only main --no-root" did not complete successfully: exit code: 1
------
 > [processing_server python_builder  7/12] RUN poetry config installer.max-workers 4 &&     poetry install --only main --no-root:
2.441        53│ 
2.441        54│     def __getitem__(self, key):
2.441        55│         # Re-insert the item, moving it to the end of the eviction line.
2.441        56│         with self.lock:
2.441     →  57│             item = self._container.pop(key)
2.441        58│             self._container[key] = item
2.441        59│             return item
2.441        60│ 
2.441        61│     def __setitem__(self, key, value):
2.441 
------

This same Dockerfile worked yesterday, so I suspect that one of Poetry 1.5.1 sub-dependencies released a new version that might have broken something? Those aren't locked for us (other than Poetry's version itself).

I will try to see if I can track down what changed transitively recently if possible, a full output of the venv that Poetry is installed into:

#9 [python_builder  5/13] RUN pip list
#9 0.562 Package                   Version
#9 0.563 ------------------------- -----------
#9 0.563 attrs                     23.1.0
#9 0.563 build                     0.10.0
#9 0.564 CacheControl              0.12.14
#9 0.564 certifi                   2023.7.22
#9 0.565 cffi                      1.15.1
#9 0.565 charset-normalizer        3.2.0
#9 0.566 cleo                      2.0.1
#9 0.567 crashtest                 0.4.1
#9 0.567 cryptography              41.0.2
#9 0.567 distlib                   0.3.7
#9 0.568 dulwich                   0.21.5
#9 0.568 filelock                  3.12.2
#9 0.569 html5lib                  1.1
#9 0.570 idna                      3.4
#9 0.570 importlib-metadata        6.8.0
#9 0.570 installer                 0.7.0
#9 0.571 jaraco.classes            3.3.0
#9 0.571 jeepney                   0.8.0
#9 0.572 jsonschema                4.18.4
#9 0.572 jsonschema-specifications 2023.7.1
#9 0.572 keyring                   23.13.1
#9 0.573 lockfile                  0.12.2
#9 0.573 more-itertools            10.0.0
#9 0.574 msgpack                   1.0.5
#9 0.574 packaging                 23.1
#9 0.575 pexpect                   4.8.0
#9 0.576 pip                       23.1.2
#9 0.576 pkginfo                   1.9.6
#9 0.577 platformdirs              3.9.1
#9 0.577 poetry                    1.5.1
#9 0.578 poetry-core               1.6.1
#9 0.578 poetry-plugin-export      1.4.0
#9 0.579 ptyprocess                0.7.0
#9 0.579 pycparser                 2.21
#9 0.579 pyproject_hooks           1.0.0
#9 0.580 rapidfuzz                 2.15.1
#9 0.580 referencing               0.30.0
#9 0.581 requests                  2.31.0
#9 0.581 requests-toolbelt         1.0.0
#9 0.581 rpds-py                   0.9.2
#9 0.582 SecretStorage             3.3.3
#9 0.582 setuptools                65.5.1
#9 0.582 shellingham               1.5.0.post1
#9 0.583 six                       1.16.0
#9 0.583 tomlkit                   0.12.0
#9 0.583 trove-classifiers         2023.7.6
#9 0.583 urllib3                   1.26.16
#9 0.584 virtualenv                20.24.2
#9 0.584 webencodings              0.5.1
#9 0.584 wheel                     0.40.0
#9 0.585 zipp                      3.16.2
@johnthagen johnthagen added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 27, 2023
@johnthagen
Copy link
Contributor Author

johnthagen commented Jul 27, 2023

Doing some bisection of Poetry versions:

  • 1.5.1: Fails
  • 1.5.0: Fails
  • 1.4.2: Succeeds

The Poetry installation environment for 1.4.2 is:

#15 0.652 Package                   Version
#15 0.652 ------------------------- -----------
#15 0.653 attrs                     23.1.0
#15 0.653 build                     0.10.0
#15 0.653 CacheControl              0.12.14
#15 0.654 certifi                   2023.7.22
#15 0.654 cffi                      1.15.1
#15 0.655 charset-normalizer        3.2.0
#15 0.655 cleo                      2.0.1
#15 0.656 crashtest                 0.4.1
#15 0.656 cryptography              41.0.2
#15 0.657 distlib                   0.3.7
#15 0.657 dulwich                   0.21.5
#15 0.657 filelock                  3.12.2
#15 0.658 html5lib                  1.1
#15 0.658 idna                      3.4
#15 0.658 importlib-metadata        6.8.0
#15 0.659 installer                 0.7.0
#15 0.659 jaraco.classes            3.3.0
#15 0.660 jeepney                   0.8.0
#15 0.660 jsonschema                4.18.4
#15 0.661 jsonschema-specifications 2023.7.1
#15 0.661 keyring                   23.13.1
#15 0.662 lockfile                  0.12.2
#15 0.662 more-itertools            10.0.0
#15 0.662 msgpack                   1.0.5
#15 0.663 packaging                 23.1
#15 0.663 pexpect                   4.8.0
#15 0.664 pip                       23.1.2
#15 0.664 pkginfo                   1.9.6
#15 0.665 platformdirs              2.6.2
#15 0.665 poetry                    1.4.2
#15 0.666 poetry-core               1.5.2
#15 0.666 poetry-plugin-export      1.3.1
#15 0.667 ptyprocess                0.7.0
#15 0.667 pycparser                 2.21
#15 0.667 pyproject_hooks           1.0.0
#15 0.668 rapidfuzz                 2.15.1
#15 0.668 referencing               0.30.0
#15 0.669 requests                  2.31.0
#15 0.669 requests-toolbelt         0.10.1
#15 0.669 rpds-py                   0.9.2
#15 0.670 SecretStorage             3.3.3
#15 0.670 setuptools                65.5.1
#15 0.670 shellingham               1.5.0.post1
#15 0.671 six                       1.16.0
#15 0.672 tomlkit                   0.12.0
#15 0.672 trove-classifiers         2023.7.6
#15 0.673 urllib3                   1.26.16
#15 0.673 virtualenv                20.21.1
#15 0.674 webencodings              0.5.1
#15 0.674 wheel                     0.40.0
#15 0.675 zipp                      3.16.2

@johnthagen
Copy link
Contributor Author

Package differences between 1.5.1 -> 1.4.2

  • platformdirs: 3.9.1 -> 2.6.2
  • poetry: 1.5.1 -> 1.4.2
  • poetry-core: 1.6.1 -> 1.5.2
  • poetry-plugin-export: 1.4.0 -> 1.3.1
  • requests-toolbelt: 1.0.0 -> 0.10.1
  • virtualenv: 20.24.2 -> 20.21.1

@dimbleby
Copy link
Contributor

If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

you've checked the box but not done this

@guigautier
Copy link

Same issue

@johnthagen
Copy link
Contributor Author

you've checked the box but not done this

@dimbleby Sorry, my bad! Here it is:

#17 [python_builder  7/12] RUN poetry config installer.max-workers 4 &&     poetry install --only main --no-root -vvv
#17 0.925 Loading configuration file /root/.config/pypoetry/config.toml
#17 0.968 Using virtualenv: /opt/venv
#17 1.127 Installing dependencies from lock file
#17 1.351 
#17 1.351 Finding the necessary packages for the current system
#17 2.445 
#17 2.445 Package operations: 39 installs, 0 updates, 0 removals
#17 2.445 
#17 2.445   • Installing idna (3.4)
#17 2.447   • Installing sniffio (1.3.0)
#17 2.469 [keyring.backend] Loading KWallet
#17 2.471 [keyring.backend] Loading KWallet
#17 2.471 [keyring.backend] Loading SecretService
#17 2.472 [keyring.backend] Loading SecretService
#17 2.485 [keyring.backend] Loading Windows
#17 2.485 [keyring.backend] Loading Windows
#17 2.487 [keyring.backend] Loading chainer
#17 2.487 [keyring.backend] Loading chainer
#17 2.487 [keyring.backend] Loading libsecret
#17 2.489 [keyring.backend] Loading libsecret
#17 2.489 [keyring.backend] Loading macOS
#17 2.489 [keyring.backend] Loading macOS
#17 2.528 No suitable keyring backend found
#17 2.528 No suitable keyring backend found
#17 2.529 No suitable keyring backends were found
#17 2.529 Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
#17 2.529 No suitable keyring backends were found
#17 2.529 Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
#17 2.530 Creating new session for pypi.org
#17 2.530 Creating new session for pypi.org
#17 2.533 [urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
#17 2.534 [urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
#17 2.651 [urllib3.connectionpool] https://pypi.org:443 "GET /pypi/sniffio/1.3.0/json HTTP/1.1" 200 2070
#17 2.652 [urllib3.connectionpool] https://pypi.org:443 "GET /pypi/idna/3.4/json HTTP/1.1" 200 4585
#17 2.655 [filelock] Attempting to acquire lock 140007681479568 on /root/.cache/pypoetry/cache/repositories/PyPI/_http/f/c/4/2/b/fc42bb0e016a3d14341082e4bfb2d5df5bc02a92eb01e5782b9d16fd.lock
#17 2.655 [filelock] Attempting to acquire lock 140007681487824 on /root/.cache/pypoetry/cache/repositories/PyPI/_http/0/a/4/6/d/0a46d9c03cfab5cc8b30b66da25c92820725db433780748fb1b717ea.lock
#17 2.655 [filelock] Lock 140007681479568 acquired on /root/.cache/pypoetry/cache/repositories/PyPI/_http/f/c/4/2/b/fc42bb0e016a3d14341082e4bfb2d5df5bc02a92eb01e5782b9d16fd.lock
#17 2.656 [filelock] Lock 140007681487824 acquired on /root/.cache/pypoetry/cache/repositories/PyPI/_http/0/a/4/6/d/0a46d9c03cfab5cc8b30b66da25c92820725db433780748fb1b717ea.lock
#17 2.656 [filelock] Attempting to release lock 140007681479568 on /root/.cache/pypoetry/cache/repositories/PyPI/_http/f/c/4/2/b/fc42bb0e016a3d14341082e4bfb2d5df5bc02a92eb01e5782b9d16fd.lock
#17 2.656 [filelock] Lock 140007681479568 released on /root/.cache/pypoetry/cache/repositories/PyPI/_http/f/c/4/2/b/fc42bb0e016a3d14341082e4bfb2d5df5bc02a92eb01e5782b9d16fd.lock
#17 2.656 [filelock] Attempting to release lock 140007681487824 on /root/.cache/pypoetry/cache/repositories/PyPI/_http/0/a/4/6/d/0a46d9c03cfab5cc8b30b66da25c92820725db433780748fb1b717ea.lock
#17 2.657 [filelock] Lock 140007681487824 released on /root/.cache/pypoetry/cache/repositories/PyPI/_http/0/a/4/6/d/0a46d9c03cfab5cc8b30b66da25c92820725db433780748fb1b717ea.lock
#17 2.715 No suitable keyring backend found
#17 2.715 No suitable keyring backends were found
#17 2.715 Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
#17 2.715 Creating new session for files.pythonhosted.org
#17 2.758 
#17 2.758   Stack trace:
#17 2.758 
#17 2.758   17  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:286 in _execute_operation
#17 2.789        284│ 
#17 2.789        285│             try:
#17 2.789      → 286│                 result = self._do_execute_operation(operation)
#17 2.789        287│             except EnvCommandError as e:
#17 2.789        288│                 if e.e.returncode == -2:
#17 2.789 
#17 2.789   16  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:388 in _do_execute_operation
#17 2.818        386│             return 0
#17 2.818        387│ 
#17 2.818      → 388│         result: int = getattr(self, f"_execute_{method}")(operation)
#17 2.818        389│ 
#17 2.818        390│         if result != 0:
#17 2.818 
#17 2.818   15  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:508 in _execute_install
#17 2.854        506│ 
#17 2.854        507│     def _execute_install(self, operation: Install | Update) -> int:
#17 2.854      → 508│         status_code = self._install(operation)
#17 2.854        509│ 
#17 2.854        510│         self._save_url_reference(operation)
#17 2.854 
#17 2.854   14  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:546 in _install
#17 2.889        544│             archive = self._download_link(operation, Link(package.source_url))
#17 2.889        545│         else:
#17 2.889      → 546│             archive = self._download(operation)
#17 2.889        547│ 
#17 2.889        548│         operation_message = self.get_operation_message(operation)
#17 2.890 
#17 2.890   13  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:750 in _download
#17 2.927        748│             self._yanked_warnings.append(message)
#17 2.927        749│ 
#17 2.927      → 750│         return self._download_link(operation, link)
#17 2.927        751│ 
#17 2.927        752│     def _download_link(self, operation: Install | Update, link: Link) -> Path:
#17 2.928 
#17 2.928   12  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:763 in _download_link
#17 2.955        761│             # No cached original distributions was found, so we download and prepare it
#17 2.955        762│             try:
#17 2.955      → 763│                 original_archive = self._download_archive(operation, link)
#17 2.955        764│             except BaseException:
#17 2.955        765│                 cache_directory = self._artifact_cache.get_cache_directory_for_link(
#17 2.955 
#17 2.955   11  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:826 in _download_archive
#17 2.983        824│ 
#17 2.983        825│     def _download_archive(self, operation: Install | Update, link: Link) -> Path:
#17 2.983      → 826│         response = self._authenticator.request(
#17 2.984        827│             "get", link.url, stream=True, io=self._sections.get(id(operation), self._io)
#17 2.984        828│         )
#17 2.984 
#17 2.984   10  /usr/local/lib/python3.11/site-packages/poetry/utils/authenticator.py:260 in request
#17 2.999        258│             is_last_attempt = attempt >= 5
#17 2.999        259│             try:
#17 2.999      → 260│                 resp = session.send(prepared_request, **send_kwargs)
#17 3.000        261│             except (requests.exceptions.ConnectionError, OSError) as e:
#17 3.000        262│                 if is_last_attempt:
#17 3.000 
#17 3.000    9  /usr/local/lib/python3.11/site-packages/requests/sessions.py:703 in send
#17 3.019        701│ 
#17 3.019        702│         # Send the request
#17 3.019      → 703│         r = adapter.send(request, **kwargs)
#17 3.019        704│ 
#17 3.019        705│         # Total elapsed time of the request (approximately)
#17 3.019 
#17 3.019    8  /usr/local/lib/python3.11/site-packages/cachecontrol/adapter.py:57 in send
#17 3.023         55│             request.headers.update(self.controller.conditional_headers(request))
#17 3.023         56│ 
#17 3.023      →  57│         resp = super(CacheControlAdapter, self).send(request, **kw)
#17 3.023         58│ 
#17 3.023         59│         return resp
#17 3.023 
#17 3.023    7  /usr/local/lib/python3.11/site-packages/requests/adapters.py:454 in send
#17 3.036        452│ 
#17 3.036        453│         try:
#17 3.036      → 454│             conn = self.get_connection(request.url, proxies)
#17 3.036        455│         except LocationValueError as e:
#17 3.036        456│             raise InvalidURL(e, request=request)
#17 3.036 
#17 3.036    6  /usr/local/lib/python3.11/site-packages/requests/adapters.py:356 in get_connection
#17 3.049        354│             parsed = urlparse(url)
#17 3.049        355│             url = parsed.geturl()
#17 3.049      → 356│             conn = self.poolmanager.connection_from_url(url)
#17 3.049        357│ 
#17 3.049        358│         return conn
#17 3.049 
#17 3.049    5  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:299 in connection_from_url
#17 3.061        297│         """
#17 3.061        298│         u = parse_url(url)
#17 3.062      → 299│         return self.connection_from_host(
#17 3.062        300│             u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs
#17 3.062        301│         )
#17 3.062 
#17 3.062    4  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:246 in connection_from_host
#17 3.074        244│         request_context["host"] = host
#17 3.074        245│ 
#17 3.074      → 246│         return self.connection_from_context(request_context)
#17 3.074        247│ 
#17 3.074        248│     def connection_from_context(self, request_context):
#17 3.074 
#17 3.074    3  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:261 in connection_from_context
#17 3.087        259│         pool_key = pool_key_constructor(request_context)
#17 3.087        260│ 
#17 3.087      → 261│         return self.connection_from_pool_key(pool_key, request_context=request_context)
#17 3.088        262│ 
#17 3.088        263│     def connection_from_pool_key(self, pool_key, request_context=None):
#17 3.088 
#17 3.088    2  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:274 in connection_from_pool_key
#17 3.100        272│             # If the scheme, host, or port doesn't match existing open
#17 3.100        273│             # connections, open a new ConnectionPool.
#17 3.100      → 274│             pool = self.pools.get(pool_key)
#17 3.100        275│             if pool:
#17 3.101        276│                 return pool
#17 3.101 
#17 3.101    1  <frozen _collections_abc>:774 in get
#17 3.101 
#17 3.101   TypeError
#17 3.101 
#17 3.101   unhashable type: 'Integer'
#17 3.101 
#17 3.101   at /usr/local/lib/python3.11/site-packages/urllib3/_collections.py:57 in __getitem__
#17 3.110        53│ 
#17 3.110        54│     def __getitem__(self, key):
#17 3.111        55│         # Re-insert the item, moving it to the end of the eviction line.
#17 3.111        56│         with self.lock:
#17 3.111     →  57│             item = self._container.pop(key)
#17 3.111        58│             self._container[key] = item
#17 3.111        59│             return item
#17 3.111        60│ 
#17 3.111        61│     def __setitem__(self, key, value):
#17 3.111 
#17 3.114 
#17 3.114   Stack trace:
#17 3.114 
#17 3.114   17  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:286 in _execute_operation
#17 3.115        284│ 
#17 3.115        285│             try:
#17 3.116      → 286│                 result = self._do_execute_operation(operation)
#17 3.116        287│             except EnvCommandError as e:
#17 3.116        288│                 if e.e.returncode == -2:
#17 3.116 
#17 3.116   16  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:388 in _do_execute_operation
#17 3.116        386│             return 0
#17 3.116        387│ 
#17 3.116      → 388│         result: int = getattr(self, f"_execute_{method}")(operation)
#17 3.116        389│ 
#17 3.116        390│         if result != 0:
#17 3.116 
#17 3.116   15  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:508 in _execute_install
#17 3.116        506│ 
#17 3.117        507│     def _execute_install(self, operation: Install | Update) -> int:
#17 3.117      → 508│         status_code = self._install(operation)
#17 3.117        509│ 
#17 3.117        510│         self._save_url_reference(operation)
#17 3.117 
#17 3.118   14  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:546 in _install
#17 3.118        544│             archive = self._download_link(operation, Link(package.source_url))
#17 3.118        545│         else:
#17 3.118      → 546│             archive = self._download(operation)
#17 3.118        547│ 
#17 3.118        548│         operation_message = self.get_operation_message(operation)
#17 3.118 
#17 3.118   13  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:750 in _download
#17 3.119        748│             self._yanked_warnings.append(message)
#17 3.119        749│ 
#17 3.119      → 750│         return self._download_link(operation, link)
#17 3.119        751│ 
#17 3.119        752│     def _download_link(self, operation: Install | Update, link: Link) -> Path:
#17 3.119 
#17 3.120   12  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:763 in _download_link
#17 3.120        761│             # No cached original distributions was found, so we download and prepare it
#17 3.120        762│             try:
#17 3.120      → 763│                 original_archive = self._download_archive(operation, link)
#17 3.120        764│             except BaseException:
#17 3.120        765│                 cache_directory = self._artifact_cache.get_cache_directory_for_link(
#17 3.120 
#17 3.120   11  /usr/local/lib/python3.11/site-packages/poetry/installation/executor.py:826 in _download_archive
#17 3.121        824│ 
#17 3.121        825│     def _download_archive(self, operation: Install | Update, link: Link) -> Path:
#17 3.121      → 826│         response = self._authenticator.request(
#17 3.121        827│             "get", link.url, stream=True, io=self._sections.get(id(operation), self._io)
#17 3.121        828│         )
#17 3.121 
#17 3.121   10  /usr/local/lib/python3.11/site-packages/poetry/utils/authenticator.py:260 in request
#17 3.121        258│             is_last_attempt = attempt >= 5
#17 3.121        259│             try:
#17 3.121      → 260│                 resp = session.send(prepared_request, **send_kwargs)
#17 3.121        261│             except (requests.exceptions.ConnectionError, OSError) as e:
#17 3.122        262│                 if is_last_attempt:
#17 3.122 
#17 3.122    9  /usr/local/lib/python3.11/site-packages/requests/sessions.py:703 in send
#17 3.122        701│ 
#17 3.123        702│         # Send the request
#17 3.123      → 703│         r = adapter.send(request, **kwargs)
#17 3.123        704│ 
#17 3.123        705│         # Total elapsed time of the request (approximately)
#17 3.123 
#17 3.123    8  /usr/local/lib/python3.11/site-packages/cachecontrol/adapter.py:57 in send
#17 3.123         55│             request.headers.update(self.controller.conditional_headers(request))
#17 3.123         56│ 
#17 3.123      →  57│         resp = super(CacheControlAdapter, self).send(request, **kw)
#17 3.124         58│ 
#17 3.124         59│         return resp
#17 3.124 
#17 3.124    7  /usr/local/lib/python3.11/site-packages/requests/adapters.py:454 in send
#17 3.124        452│ 
#17 3.124        453│         try:
#17 3.124      → 454│             conn = self.get_connection(request.url, proxies)
#17 3.124        455│         except LocationValueError as e:
#17 3.125        456│             raise InvalidURL(e, request=request)
#17 3.125 
#17 3.125    6  /usr/local/lib/python3.11/site-packages/requests/adapters.py:356 in get_connection
#17 3.125        354│             parsed = urlparse(url)
#17 3.125        355│             url = parsed.geturl()
#17 3.126      → 356│             conn = self.poolmanager.connection_from_url(url)
#17 3.126        357│ 
#17 3.126        358│         return conn
#17 3.126 
#17 3.126    5  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:299 in connection_from_url
#17 3.126        297│         """
#17 3.126        298│         u = parse_url(url)
#17 3.126      → 299│         return self.connection_from_host(
#17 3.127        300│             u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs
#17 3.127        301│         )
#17 3.127 
#17 3.127    4  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:246 in connection_from_host
#17 3.127        244│         request_context["host"] = host
#17 3.127        245│ 
#17 3.127      → 246│         return self.connection_from_context(request_context)
#17 3.128        247│ 
#17 3.128        248│     def connection_from_context(self, request_context):
#17 3.128 
#17 3.128    3  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:261 in connection_from_context
#17 3.128        259│         pool_key = pool_key_constructor(request_context)
#17 3.128        260│ 
#17 3.128      → 261│         return self.connection_from_pool_key(pool_key, request_context=request_context)
#17 3.128        262│ 
#17 3.128        263│     def connection_from_pool_key(self, pool_key, request_context=None):
#17 3.129 
#17 3.129    2  /usr/local/lib/python3.11/site-packages/urllib3/poolmanager.py:274 in connection_from_pool_key
#17 3.129        272│             # If the scheme, host, or port doesn't match existing open
#17 3.129        273│             # connections, open a new ConnectionPool.
#17 3.129      → 274│             pool = self.pools.get(pool_key)
#17 3.129        275│             if pool:
#17 3.129        276│                 return pool
#17 3.129 
#17 3.129    1  <frozen _collections_abc>:774 in get
#17 3.129 
#17 3.130   TypeError
#17 3.130 
#17 3.130   unhashable type: 'Integer'
#17 3.130 
#17 3.130   at /usr/local/lib/python3.11/site-packages/urllib3/_collections.py:57 in __getitem__
#17 3.139        53│ 
#17 3.139        54│     def __getitem__(self, key):
#17 3.139        55│         # Re-insert the item, moving it to the end of the eviction line.
#17 3.139        56│         with self.lock:
#17 3.139     →  57│             item = self._container.pop(key)
#17 3.139        58│             self._container[key] = item
#17 3.139        59│             return item
#17 3.139        60│ 
#17 3.139        61│     def __setitem__(self, key, value):
#17 3.139 
#17 ERROR: process "/bin/sh -c poetry config installer.max-workers 4 &&     poetry install --only main --no-root -vvv" did not complete successfully: exit code: 1
------
 > [python_builder  7/12] RUN poetry config installer.max-workers 4 &&     poetry install --only main --no-root -vvv:
3.139        53│ 
3.139        54│     def __getitem__(self, key):
3.139        55│         # Re-insert the item, moving it to the end of the eviction line.
3.139        56│         with self.lock:
3.139     →  57│             item = self._container.pop(key)
3.139        58│             self._container[key] = item
3.139        59│             return item
3.139        60│ 
3.139        61│     def __setitem__(self, key, value):
3.139 
------
Dockerfile:25
--------------------
  24 |     COPY pyproject.toml poetry.lock ./
  25 | >>> RUN poetry config installer.max-workers 4 && \
  26 | >>>     poetry install --only main --no-root -vvv
  27 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c poetry config installer.max-workers 4 &&     poetry install --only main --no-root -vvv" did not complete successfully: exit code: 1

@myakove
Copy link

myakove commented Jul 27, 2023

Same here, since today.
Yesterday it was working as expected.

On my PC it is still working but start to fail today when tried to execute it inside the container.
Seems like something in the OS (mine if Fedora 38) was changed and cause the issue.

Using poetry==1.4.2 works inside the container.

@dimbleby
Copy link
Contributor

seems pretty clear that nothing has changed in poetry

if you don't figure it out yourselves I expect that whatever it is in the ecosystem that has broken will affect other projects too, so sooner or later it'll reach someone who has an idea what's going on...!

@johnthagen
Copy link
Contributor Author

Last update to python:3.11-slim-bullseye image seems to be 23 days ago, so it would appear it's not the container:

@guigautier
Copy link

Pinning "tomlkit < 0.12.0" solved it for us.

@johnthagen
Copy link
Contributor Author

johnthagen commented Jul 27, 2023

@guigautier You beat me to it by a minute 😆

After searching them all, I found one offending package, tomlkit that had been released in the past 6 hours:

A temporary workaround to address this issue:

RUN pip install "poetry==1.5.1" "tomlkit<0.12.0"

@johnthagen
Copy link
Contributor Author

Sidenote, this issue is the kind of motivation I have for

@dimbleby
Copy link
Contributor

seems surely unwanted that an integer would be not hashable, I expect tomlkit would welcome the bug report

@Secrus
Copy link
Member

Secrus commented Jul 27, 2023

@frostming For your attention

@Secrus Secrus added status/external-issue Issue is caused by external project (platform, dep, etc) and removed status/triage This issue needs to be triaged labels Jul 27, 2023
@aidanrussell-infogrid
Copy link

Just to say that for whatever reason the posted fix wouldn't execute but if I tweaked it to this then it was resolved:
RUN pip install poetry==1.5.1 tomlkit==0.11.8

Many thanks @guigautier @johnthagen

@johnthagen
Copy link
Contributor Author

@aidanrussell-infogrid It might be because I omitted some " ", I've updated the answer. Thank you for the feedback.

@frostming
Copy link
Contributor

@frostming For your attention

Thanks, a quick fix will be released.

@gerbenoostra
Copy link

gerbenoostra commented Jul 27, 2023

For me it works again, fix has been released at https://pypi.org/project/tomlkit/0.12.1/

@PidgeyBE
Copy link

Isn't it a bit ironical that poetry dependencies aren't pinned? 😄

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

No branches or pull requests

9 participants