Skip links

Setup error: network unreachable for pip

We recently saw a user experiencing an error running the MetroAE setup script:

# ./metro-setup.sh

Setting up Nuage Metro Automation Engine

Checking user privileges...                                [  OK  ]
Checking OS type...                                        [  OK  ]
Checking OS version...                                     [  OK  ]
Installing epel-release...                                 [  OK  ]
Installing @Development tools...                           [  OK  ]
Installing python2-pip...                                  [  OK  ]
Installing python-devel.x86_64...                          [  OK  ]
Installing python2-jmespath...                             [  OK  ]
Installing openssl-devel...                                [  OK  ]
Installing sshpass...                                      [  OK  ]
Installing git...                                          [  OK  ]
Installing python-netaddr...                               [  OK  ]
Installing libguestfs-tools...                             [  OK  ]
Installing pip packages                                    [FAILED]

Collecting ansible==2.4.0.0 (from -r pip_requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/ansible/
  Could not find a version that satisfies the requirement ansible==2.4.0.0 (from -r pip_requirements.txt (line 1)) (from versions: )
No matching distribution found for ansible==2.4.0.0 (from -r pip_requirements.txt (line 1))
[ FAILED ]
There appears to be some errors. Please check ./metro-setup.log for details

The important error here is

Failed to establish a new connection: [Errno 101] Network is unreachable

The complaint that pip could not find a version that satisfies the requirement is caused by the failure to connect to the pip repo.

Notice that the installation of the yum packages, e.g. python2-pip, succeeded. After a bit of checking, the user discovered that the problem was that he was using a yum proxy, but no proxy was configured for pip. He was able to solve the problem by setting HTTP and HTTPS proxies in his environment:

export HTTPS_PROXY=http://x.x.x.x:y

export HTTP_PROXY=http://x.x.x.x:y

After these settings were added to the environment, the metro-setup script ran to completion without error.

Bitnami