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

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

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

Comments

Projects
None yet
2 participants
@ronaldoussoren

ronaldoussoren commented May 13, 2013

"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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode May 13, 2013

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@ronaldoussoren

ronaldoussoren May 16, 2013

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.

ronaldoussoren commented May 16, 2013

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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode May 17, 2013

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode May 19, 2013

Contributor

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

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 May 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment