pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.55k stars 3.04k forks source link

`--no-clean` doesn't work when installing from local paths or dists #2779

Open qwcode opened 9 years ago

qwcode commented 9 years ago

--no-clean doesn't work when installing from local projects or local dists

e.g. the following don't work

pip install  --no-clean someprojectdir/
pip install  --no-clean someproject-1.3.tar.gz

for an example, see https://github.com/pypa/pip/pull/2689#issuecomment-93604421 (this is a tox example, where tox installs from a local zip file)

qwcode commented 9 years ago

this was seen in v 6.08 and v 6.1.1

in the unreleased 7.0, installing from local dists works (the 2nd case mentioned in the description), but still not the first case.

a caveat here though is that --no-clean now leaves behind the built wheel "source", not the actual sdist source, even if you installed from an sdist.

techtonik commented 8 years ago

Same with 7.1.2

techtonik commented 8 years ago

The way to fix it is to move directory management into centralized temporary stack manager that will keep track on who and where created temp directories. It may also provide transaction support - so that only the context that created temp dir can clean it.

djpeaco commented 8 years ago

I'm having problems using --no-clean at all, not just when installing from local paths. For example

$ pip install --no-cache-dir --no-clean -v netifaces

The final output is:

  ...
  Downloading from URL https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e (from https://pypi.python.org/simple/netifaces/)
  Running setup.py (path:/tmp/pip-build-_yORAp/netifaces/setup.py) egg_info for package netifaces
    Running command python setup.py egg_info
  Source in /tmp/pip-build-_yORAp/netifaces has version 0.10.4, which satisfies requirement netifaces from https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e
Installing collected packages: netifaces
  Running setup.py install for netifaces ...     Running command /home/djpeaco/.enthought/Canopy_64bit/User/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_yORAp/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-FEEBuO-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/djpeaco/.enthought/Canopy_64bit/User/include/site/python2.7/netifaces
done
  Removing source in /tmp/pip-build-_yORAp/netifaces
Successfully installed netifaces-0.10.4

And nothing is left in /tmp/pip-build-_yORAp/. The same happens if I use --build to specifiy another directory to download into. This is with:

abalkin commented 7 years ago

Are there any plans to fix this? The only related activity so far is closing another issue (#4679) as a duplicate of this one. I see the same problem with pip 9.0.1, python 3.6.

chrahunt commented 5 years ago

As mentioned in #6982, we may be able to consolidate the logic for handling our temporary directories then the fix for this will be in one place.

gutsytechster commented 4 years ago

With the latest pip version, I have used --no-clean, but I found that if a package is installed then, it does keep the build directory within /tmp/ location. However, if the same package is re-installed, it keeps the new directory, built in the re-installation, but with no content at all.

To me, it seems that the second time the package is installed, pip identifies that the package is installed earlier and does not build the wheel again, hence no content in the temp directory second time. Is it the scenario or is there something else?

For local paths, again I had a git repo cloned, specifically this, and I run the command pip install --no-clean -v .. And it kept the temporary build directory with all the contents preserved. However, I found the same behaviour as above when re-installing i.e. a new directory indeed is created on re-instaling with --no-clean, but with no content.