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

Already on GitHub? Sign in to your account

Pip doesn't delete build dir when interrupted with Ctrl-c #413

Closed
brickZA opened this Issue Dec 20, 2011 · 5 comments

Comments

Projects
None yet
5 participants

brickZA commented Dec 20, 2011

Apart from polluting $PWD with the build dir, it will result in the next invocation of pip to install the same package to ignore any version requirements; instead it will just install the version of the package that is in the build dir. E.g.

$ sudo pip -v install mplh5canvas==0.5 
Downloading/unpacking mplh5canvas==0.5
  Could not fetch URL http://pypi.python.org/simple/mplh5canvas/0.5: HTTP Error 404: Not Found
  Will skip URL http://pypi.python.org/simple/mplh5canvas/0.5 when looking for download links for mplh5canvas==0.5
  Ignoring link http://pypi.python.org/packages/source/m/mplh5canvas/mplh5canvas-0.6.tar.gz#md5=83d9c9d8da784391216b4dbe4813f7e8 (from http://pypi.python.org/simple/mplh5canvas/), version 0.6 doesn't match ==0.5
  Downloading mplh5canvas-0.5.tar.gz (59Kb): 59Kb downloaded
  Running setup.py egg_info for package mplh5canvas
    running egg_info
    creating pip-egg-info/mplh5canvas.egg-info
    writing pip-egg-info/mplh5canvas.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/mplh5canvas.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/mplh5canvas.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
Installing collected packages: mplh5canvas
  Running setup.py install for mplh5canvas
^COperation cancelled by user
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
    self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 228, in run
    requirement_set.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1100, in install
    requirement.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 572, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 230, in call_subprocess
    line = console_to_str(stdout.readline())
KeyboardInterrupt

$ ls $PWD/build
mplh5canvas  pip-delete-this-directory.txt

If we now try an install a different version of the package

$ sudo pip -v install mplh5canvas==0.6 
Downloading/unpacking mplh5canvas==0.6
  Running setup.py egg_info for package mplh5canvas
    running egg_info
    writing pip-egg-info/mplh5canvas.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/mplh5canvas.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/mplh5canvas.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
Installing collected packages: mplh5canvas
  Running setup.py install for mplh5canvas
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/memorizingfile.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/backend_h5canvas.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/simple_server.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/msgutil.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/base_page.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/management_server.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    copying mplh5canvas/__init__.py -> build/lib.linux-x86_64-2.7/mplh5canvas
    creating build/lib.linux-x86_64-2.7/mplh5canvas/handshake
    copying mplh5canvas/handshake/handshake.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
    copying mplh5canvas/handshake/draft75.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
    copying mplh5canvas/handshake/_base.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
    copying mplh5canvas/handshake/__init__.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
    running install_lib
    creating /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/memorizingfile.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    creating /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
    copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/handshake.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
    copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/draft75.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
    copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/_base.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
    copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/__init__.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
    copying build/lib.linux-x86_64-2.7/mplh5canvas/backend_h5canvas.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/simple_server.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/msgutil.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/base_page.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/management_server.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    copying build/lib.linux-x86_64-2.7/mplh5canvas/__init__.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/memorizingfile.py to memorizingfile.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/handshake.py to handshake.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/draft75.py to draft75.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/_base.py to _base.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/__init__.py to __init__.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/backend_h5canvas.py to backend_h5canvas.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/simple_server.py to simple_server.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/msgutil.py to msgutil.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/base_page.py to base_page.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/management_server.py to management_server.pyc
    byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/__init__.py to __init__.pyc
    running install_egg_info
    running egg_info
    writing mplh5canvas.egg-info/PKG-INFO
    writing top-level names to mplh5canvas.egg-info/top_level.txt
    writing dependency_links to mplh5canvas.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'mplh5canvas.egg-info/SOURCES.txt'
    writing manifest file 'mplh5canvas.egg-info/SOURCES.txt'
    Copying mplh5canvas.egg-info to /usr/local/lib/python2.7/dist-packages/mplh5canvas-0.5-py2.7.egg-info
    running install_scripts
    writing list of installed files to '/tmp/pip-QUEhbq-record/install-record.txt'
Successfully installed mplh5canvas
Cleaning up...
  Removing temporary dir /home/nmarais/build...

if we check the version we see

$ yolk -a | grep mplh
mplh5canvas     - 0.5          - active development (/usr/local/lib/python2.7/dist-packages)

i.e. verion 0.5 was installed, not the requested 0.6. However, the last invocation of pip did actually clean up the build dir, so if we try again

$ sudo pip install mplh5canvas==0.6 
Downloading/unpacking mplh5canvas==0.6
  Downloading mplh5canvas-0.6.tar.gz (57Kb): 57Kb downloaded
  Running setup.py egg_info for package mplh5canvas

Requirement already satisfied (use --upgrade to upgrade): mod-pywebsocket in /usr/local/lib/python2.7/dist-packages (from mplh5canvas==0.6)
Installing collected packages: mplh5canvas
  Found existing installation: mplh5canvas 0.5
    Uninstalling mplh5canvas:
      Successfully uninstalled mplh5canvas
  Running setup.py install for mplh5canvas

Successfully installed mplh5canvas
Cleaning up...

we get the version we are looking for

$ yolk -a | grep mplh
mplh5canvas     - 0.6          - active development (/usr/local/lib/python2.7/dist-packages)
Contributor

carljm commented Dec 20, 2011

This is really two separate bugs - ideally pip should delete the build directory even when interrupted, but even if a build directory is present with an unpacked sdist for a requested package, pip ought to check the version before installing from it.

Thanks for the report!

This just cost us two hours. Would you welcome a pull request, or is it already being worked on? :)

Contributor

carljm commented Apr 6, 2012

I'm not aware of anyone working on it, pull request certainly welcome.

mihneadb added a commit to mihneadb/pip that referenced this issue Jun 16, 2012

scjody commented Oct 22, 2012

I opened issue 709 to cover the second issue reported here: an old version of a package in build/ prevents the package from being upgraded.

Contributor

qwcode commented Apr 20, 2013

closing due to merge of #865

@qwcode qwcode closed this Apr 20, 2013

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