Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extremely slow pip installs

Any sort of pip command that contacts pypi is running extremely slow on Ubuntu 18.04.

$ pip install -v pandas                        
Created temporary directory: /tmp/pip-ephem-wheel-cache-hvbcg1k_
Created temporary directory: /tmp/pip-install-7_spppvw
Collecting pandas
  1 location(s) to search for versions of pandas:
  * https://pypi.org/simple/pandas/
  Getting page https://pypi.org/simple/pandas/
  Looking up "https://pypi.org/simple/pandas/" in the cache
  Current age based on date: 324440
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  Starting new HTTPS connection (1): pypi.org

Which hangs for ~1-2 minutes (at least).

Using the option --index-url=http://pypi.python.org/simple/ speeds it up a lot, but doesn't seem to be ideal because it skips encryption. Is there any workaround for this?

like image 370
Carlo Mazzaferro Avatar asked Jun 10 '18 19:06

Carlo Mazzaferro


People also ask

How do I make pip install faster?

Going (very slightly) faster by disabling the version check On startup pip may check if you're running the latest version or not, and print a warning if you're not. You can disable this check like so: pip --disable-pip-version-check install ...

How do I clear my pip cache?

If you want to force pip to clear out its download cache and use the specific version you can do by using --no-cache-dir command. If you are using an older version of pip than upgrade it with pip install -U pip. This will help you clear pip cache.

How do I fix pip not installing?

A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.

What can I use instead of pip install?

npm, Homebrew, Yarn, RequireJS, and Bower are the most popular alternatives and competitors to pip.


1 Answers

This symptom can indicate an IPv6 routing or DNS problem. Anyone hitting this might try disabling IPv6 as a workaround until you find the root cause. You can temporarily disable IPv6 on Ubuntu (until next reboot) by doing this:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
like image 124
stevegt Avatar answered Sep 26 '22 07:09

stevegt