Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.


2 Answers

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)
  ...

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
like image 45
link89 Avatar answered Oct 22 '25 09:10

link89



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!