cloudify-cosmo / wagon

Creates Wheel based archives to allow portable offline installation of Python packages and their dependencies
Apache License 2.0
108 stars 14 forks source link

wagon's invocation of `pip install` still tries to contact PyPI #126

Closed OddBloke closed 4 years ago

OddBloke commented 5 years ago

This can be reproduced like this:

lxc launch ubuntu:x reproducer
lxc exec reproducer /bin/bash
apt update -y
apt install -y virtualenv
virtualenv -p $(which python3) venv
. venv/bin/activate
pip install git+https://github.com/cloudify-cosmo/wagon
wagon create Django
/etc/init.d/networking stop
wagon install Django-2.1.5-py27-none-any.wgn

This will eventually succeed, but takes a lot longer than normal because every individual package installation has lines like this:

Collecting Django
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68eaca8b70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68eaca8898>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68ead04f28>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68ead04fd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f68eaca83c8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/django/

I've tracked this down: when wagon install calls pip, it does this:

/root/venv/bin/pip install Django --only-binary --no-index --find-links /tmp/tmpzLn8ik/Django/wheels --pre

However, --only-binary actually takes an argument, so it swallows the --no-index from the command-line, meaning that pip tries to contact PyPI.

(This may be related to #56, but I'm not seeing the same error output so I'm not sure.)

OddBloke commented 5 years ago

I'm going to look at working up a patch for this now.

geokala commented 4 years ago

We've changed the way pip is invoked now- it should be invoked correctly with --no-index now. Please reopen this if the issue recurs.