Skip to content

Ctrl-C during installation from sdist does not terminate correctly in wheel build #5349

Open
@pv

Description

@pv
  • Pip version: 10.0.1
  • Python version: 3.6.5
  • Operating system: Linux/Fedora

Description:

Hitting Ctrl-C when pip is building a wheel from sdist does not make pip to terminate the installation.
Instead, pip continues to run setup.py install instead.

I would have expected pip to give up building if the user interrupted the wheel build, and terminate immediately afterwards (since there is nothing to unroll).

What I've run:

$ python3 -mpip --version
pip 10.0.1 from /home/pauli/.local/lib/python3.6/site-packages/pip (python 3.6)
$ python3 -mpip install numpy==1.8.2
Collecting numpy==1.8.2
  Downloading https://files.pythonhosted.org/packages/67/ab/41e4b42e0519d868347d2cf1051a05ce0170632039c053dee8ffe8b43b0b/numpy-1.8.2.tar.gz (3.8MB)
    100% |████████████████████████████████| 3.8MB 4.9MB/s 
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... <<pressed Ctrl-C on the keyboard here>>
\^error
  Failed building wheel for numpy
  Running setup.py clean for numpy
Failed to build numpy
s3cmd 2.0.1 requires python-magic, which is not installed.
pandas-datareader 0.6.0 requires requests-ftp, which is not installed.
pandas-datareader 0.6.0 requires wrapt, which is not installed.
pywavelets 0.5.2 has requirement numpy>=1.9.1, but you'll have numpy 1.8.2 which is incompatible.
pandas 0.22.0 has requirement numpy>=1.9.0, but you'll have numpy 1.8.2 which is incompatible.
astropy 3.0.1 has requirement numpy>=1.10.0, but you'll have numpy 1.8.2 which is incompatible.
theano 1.0.1 has requirement numpy>=1.9.1, but you'll have numpy 1.8.2 which is incompatible.
awscli 1.14.50 has requirement botocore==1.9.3, but you'll have botocore 1.9.1 which is incompatible.
awscli 1.14.50 has requirement colorama<=0.3.7,>=0.2.5, but you'll have colorama 0.3.9 which is incompatible.
Installing collected packages: numpy
  Found existing installation: numpy 1.14.2
    Uninstalling numpy-1.14.2:
      Successfully uninstalled numpy-1.14.2
  Running setup.py install for numpy ... <<pressed Ctrl-C on the keyboard here>>
\^canceled
  Rolling back uninstall of numpy
Exception:
Traceback (most recent call last):
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 335, in run
    use_user_site=options.use_user_site,
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/req/__init__.py", line 49, in install_given_reqs
    **kwargs
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 779, in install
    spinner=spinner,
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 663, in call_subprocess
    line = console_to_str(proc.stdout.readline())
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 376, in run
    requirement_set.cleanup_files()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/req/req_set.py", line 164, in cleanup_files
    req.remove_temporary_source()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 870, in remove_temporary_source
    rmtree(self.source_dir)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/six.py", line 693, in reraise
    raise value
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 108, in rmtree
    onerror=rmtree_errorhandler)
  File "/usr/lib64/python3.6/shutil.py", line 476, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/usr/lib64/python3.6/shutil.py", line 474, in rmtree
    fd = os.open(path, os.O_RDONLY)
PermissionError: [Errno 13] Lupa evätty: '/tmp/pip-install-4p0m9crh/numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 377, in run
    wheel_cache.cleanup()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/utils/temp_dir.py", line 58, in __exit__
    self.cleanup()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/utils/temp_dir.py", line 81, in cleanup
    rmtree(self.path)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/six.py", line 693, in reraise
    raise value
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_vendor/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/home/pauli/.local/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 108, in rmtree
    onerror=rmtree_errorhandler)
  File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib64/python3.6/shutil.py", line 414, in _rmtree_safe_fd
    onerror(os.open, fullname, sys.exc_info())
  File "/usr/lib64/python3.6/shutil.py", line 412, in _rmtree_safe_fd
    dirfd = os.open(name, os.O_RDONLY, dir_fd=topfd)
PermissionError: [Errno 13] Lupa evätty: 'numpy'

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: testsTesting and related thingstype: maintenanceRelated to Development and Maintenance Processes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions