Binderhub failed to download the package

Our servers are based in mainland China, and when I download the python package:

Step 40/51 : RUN ${KERNEL_PYTHON_PREFIX}/bin/pip install --no-cache-dir -r “requirements.txt”
—> Running in f39e8d0e05c1
Collecting numpy
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f6bf37e6490>, ‘Connection to timed out. (connect timeout=15)’)’: /packages/86/c9/9f9d6812fa8a031a568c2c1c49f207a0a4030ead438644c887410fc49c8a/numpy-1.23.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Downloading numpy-1.23.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)

github: GitHub - harukimisola/test: test
use_registry: true
image_prefix: “
hub_url: “
How do I solve the timeout problem? Thanks for any help

Was this a temporary failure due to the remote server being inaccessible- if so retrying after a few hours usually fixes things. Or does it always happen?

1 Like

Thank you for your reply!
This is not a temporary faliure, I’ve tried many times. And the downloading problem is common in here. It is usually not feasible to download directly from the official website using pip, we usually download the package of python in our image source.
I thought I should modify the download source in the config.yaml, but I don’t know how to write this code.

I modified the installation source of the python package in the requirement.txt and it is now available for download. Like this:

Each package needs to go to the image website to find the corresponding download link, although it is troublesome, but it can work.

BinderHub internally uses repo2docker to build containers. repo2docker essentially generates a Dockerfile from a template, and builds an image from it. For example this is where the pip install ... requirements.txt is generated:

According to this StackOverflow answer you can create a configuration file for pip.

BinderHub uses a configurable repo2docker image

so you could maybe extend the default image with a pip configuration file?

1 Like

Thanks for your selfless help, it was very useful!

1 Like