All Products
Document Center

How to fix the PIP timeout errors of ECS instance

Last Updated: Jan 06, 2019

Pip is one of the most popular package management utilities used to install and manage software packages written in Python. Many Alibaba Cloud users use pip to install and update Python-packages. The following are the three Alibaba Cloud provided sites of pip:

  • (Default). Internet:

  • Virtual Private Cloud (VPC) intranet:

  • Classic network intranet:


Pip requests of Linux instances are timed out and have no response occasionally. See the following list for the affected Alibaba Cloud public images.

  • CentOS
  • Debian
  • Ubuntu
  • SUSE
  • OpenSUSE
  • Aliyun Linux


The default mirror site of Alibaba Cloud for pip requests is, which requires your instance to access the Internet. Consequently, pip access latency occurs in the instance that has no Internet IP.


You can use any one of the following solutions to fix the error.

Solution 1

Allocate an Internet IP to your Linux instance. You can bind an EIP address to the Linux instance. For a subscribed instance, you can also allocate an Internet IP while upgrading the instance configurations.

Solution 2

If you do not want to assign Internet IPs to your instances, you can fix the problem manually by running the and try the pip action again.

  1. Connect to the Linux instance.

  2. Run wget to download the script.

  3. Run script:

    • For a VPC-Connected instance: Run bash "".

    • For a classic network-connected instance: Run bash "".

  4. Try the pip action again.

See the following code snippet of the for reference.

  1. #!/bin/bash
  2. function config_pip() {
  3. pypi_source=$1
  4. if [[ ! -f ~/.pydistutils.cfg ]]; then
  5. cat > ~/.pydistutils.cfg << EOF
  6. [easy_install]
  7. index-url=http://$pypi_source/pypi/simple/
  8. EOF
  9. else
  10. sed -i "s#index-url.*#index-url=http://$pypi_source/pypi/simple/#" ~/.pydistutils.cfg
  11. fi
  12. if [[ ! -f ~/.pip/pip.conf ]]; then
  13. mkdir -p ~/.pip
  14. cat > ~/.pip/pip.conf << EOF
  15. [global]
  16. index-url=http://$pypi_source/pypi/simple/
  17. [install]
  18. trusted-host=$pypi_source
  19. EOF
  20. else
  21. sed -i "s#index-url.*#index-url=http://$pypi_source/pypi/simple/#" ~/.pip/pip.conf
  22. sed -i "s#trusted-host.*#trusted-host=$pypi_source#" ~/.pip/pip.conf
  23. fi
  24. }
  25. config_pip $1