Passing --no-cache-dir should not affect whether to use a wheel · Issue #5749 · pypa/pip (original) (raw)

At the moment the help output for --no-cache-dir just says: Disable the cache.

Till a week ago, I was under the impression that it meant that pip wouldn't use a cached wheel, and wouldn't cache a wheel fetched from PyPI.

What I didn't know was that when this option is enabled and a package has to be installed from an sdist, pip doesn't actually create a wheel and ends up creating egg-info directories, instead of dist-info ones.

Quick example:

$ pip install https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz
Collecting https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz
  Downloading https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz (318kB)
    100% |████████████████████████████████| 327kB 17.3MB/s 
Building wheels for collected packages: pytz <------------------------- Builds a 'wheel'
  Running setup.py bdist_wheel for pytz ... done
  Stored in directory: /home/nwani/.cache/pip/wheels/0d/29/29/5c4384ddcad4ea97cb91f7ff4ef13ab3cff23ddaf35ce02d21
Successfully built pytz
Installing collected packages: pytz
Successfully installed pytz-2018.5
$ find $PREFIX -type d | grep pytz-2018.5
/tmp/wani.1535901395/dev/lib/python2.7/site-packages/pytz-2018.5.dist-info  <------ 'dist-info'
$ pip install https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz --no-cache-dir
Collecting https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz
  Downloading https://files.pythonhosted.org/packages/ca/a9/62f96decb1e309d6300ebe7eee9acfd7bccaeedd693794437005b9067b44/pytz-2018.5.tar.gz (318kB)
    100% |████████████████████████████████| 327kB 52.1MB/s 
Installing collected packages: pytz
  Running setup.py install for pytz ... done  <------------------------ No 'wheel' ?
Successfully installed pytz-2018.5
$ find $PREFIX -type d | grep pytz-2018.5
/tmp/wani.1535901395/dev/lib/python2.7/site-packages/pytz-2018.5-py2.7.egg-info <----- 'egg-info'

In the case of '--no-cache-dir', would it not be possible for pip to still build the wheel but throw it away after installation?