poetry install - ConnectionError | Failed to establish a new connection: [Errno 101] Network is unreachable'
Asked Answered
H

3

3

I am using Poetry version 1.1.7.

Running poetry install yields this error.

Can this be resolved through bash or is this explicitly to do with my network? Note: Internet connectivity it perfectly fine in browsers.

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry install
Updating dependencies
Resolving dependencies... (225.5s)

  ConnectionError

  HTTPSConnectionPool(host='pkgs.dev.azure.com', port=443): Max retries exceeded with url: <CENSORED> (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f53950c3ee0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))

  at ~/.poetry/lib/poetry/_vendor/py3.8/requests/adapters.py:516 in send
      512│             if isinstance(e.reason, _SSLError):
      513│                 # This branch is for urllib3 v1.22 and later.
      514│                 raise SSLError(e, request=request)
      515│ 
    → 516│             raise ConnectionError(e, request=request)
      517│ 
      518│         except ClosedPoolError as e:
      519│             raise ConnectionError(e, request=request)
      520│ 

A 401 Unauthorized Error is thrown when pasting the URL into my browser.

Hm answered 6/8, 2021 at 10:24 Comment(5)
have you set poetry to look for packages somewhere other than PyPI? cause it looks like its trying to connect to a private Azure package distOsmanli
Looks like a network error Network is unreachable. If you meant to install from that azure server (poetry config --list, docs), make sure you resolve any network issues. Either you're blocked from reaching this destination (corporate VPN?) or your local settings (iptables, corporate policies) are blocking you.Stuffed
@MatthewBarlowe Yes, I did export POETRY_REPOSITORIES_AZURE_URL="my_url" intentionally. I have every other time for workHm
A 401 Unauthorized Error is thrown when pasting the URL into my browser.Hm
Sometimes it happens because of internet issues and next time it can run successfullyBeetner
H
3

I did:

  • poetry self update 1.0.10
  • poetry install

Terminal is giving me installs now, as it should.

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry self update 1.0.10
Updating to 1.0.10
 - Downloading poetry-1.0.10-linux.tar.gz 100%

Poetry (1.0.10) is installed now. Great!
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry install
Updating dependencies
Resolving dependencies... (101.5s)

Writing lock file


Package operations: 167 installs, 0 updates, 0 removals

  - Installing six (1.16.0)
  ...
Hm answered 6/8, 2021 at 13:1 Comment(0)
A
2

I have the same issue and it turns out to be connection refused by server due to exceeding the max connections limit of the mirror repo.

By default poetry's max installer.max-workers is set to number_of_cores + 4. This would be a problem when you run poetry on a server with like 24 cores and it is reasonable for the server side to refuse that many of connections.

The work around is to config this value manually before executing poetry install, you can use the following command to do limit the max connections:

poetry config installer.max-workers 4
Akbar answered 30/9, 2022 at 6:34 Comment(0)
M
0

In case somebody here is looking for this problem solution:

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa0c6e47510>: Failed to establish a new connection: [Errno 110] Connection timed out')'

You may try to change poetry version to 1.1.8 and add settings to pyproject.toml:

[build-system]
requires = ["poetry>=1.1.1", "setuptools", "cython"]
build-backend = "poetry.masonry.api"
Mosstrooper answered 18/5, 2023 at 12:26 Comment(1)
didn't work for me, still get that errorLied

© 2022 - 2024 — McMap. All rights reserved.