Skip to content

global pip install doesn't clean up temporary directories #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ronaldoussoren opened this issue May 13, 2013 · 4 comments
Closed

global pip install doesn't clean up temporary directories #939

ronaldoussoren opened this issue May 13, 2013 · 4 comments
Labels
auto-locked Outdated issues that have been locked by automation
Milestone

Comments

@ronaldoussoren
Copy link

"pip install" creates a working directory in /tmp ("/tmp/pip-build-$USERNAME"). This directory is not removed when the installation is done, and still contains the extracted archive for the package you installed without version information. That is, after 'pip install foo==1.0' the directory /tmp/pip-build-$USER still exists, and contains a subdirectory 'foo'.

When the user doesn't clean up the directory manually pip refuses to install updates (pip install foo==2.0), for example with "pip install lxml==3.2.1":

pip install lxml==3.2.1
Downloading/unpacking lxml==3.2.1
  Running setup.py egg_info for package lxml
    /opt/python2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.2.0.
    Building without Cython.
    Using build configuration of libxslt 1.1.15
    Building against libxml2/libxslt in the following directory: /usr/lib

    warning: no files found matching '*.txt' under directory 'src/lxml/tests'
  Requested lxml==3.2.1, but installing version 3.2.0

This is rather annoying, as even when pip claims to have finished I still have to verify that it actually installed the package I requested instead of some older version that happens to be the last version I tried to install earlier.

@qwcode
Copy link
Contributor

qwcode commented May 13, 2013

there's recent commits (#865) in the develop branch for proper build cleanup when operating in a virtualenv.

the "pip-build-username" pattern is for global pip installs, and I just checked and it's still not being cleaned up properly.

adding to 1.4 milestone. I'll look at this

@ronaldoussoren
Copy link
Author

Why does the code not use tempfile.mkdtemp to create the working directory? That way the scratch directory is unique and can always be cleaned up. You'd also avoid problems with guessable names in /tmp.

@qwcode
Copy link
Contributor

qwcode commented May 17, 2013

pip has a legacy of using fixed build dirs, as best I can tell, due to the "workflow" of the --no-install/--no-download options. my intention is to refactor much of this in #906 in v1.5.

1.5 milestone: https://github.com/pypa/pip/issues?milestone=2&state=open

but for v1.4, the quick fix is that /tmp/pip-build-$USERNAME" needs pip's delete marker dropped into it, when it's created, and pip will clean it up. will merge that fix soon.

@qwcode
Copy link
Contributor

qwcode commented May 19, 2013

closing due to merge of #948
#906 in v1.5 will contain a better fix.

@qwcode qwcode closed this as completed May 19, 2013
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

2 participants