pypa / pip

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

how to stop install packages from cache #6765

Closed cindy-li-qa closed 5 years ago

cindy-li-qa commented 5 years ago

When running jobs on jenkins parallel, some jobs failed to run with the following error:

python2.7-qa1 installdeps: --no-cache-dir, -rrequirements.txt, :EB_SERVER:<my-package1>, :EB_SERVER:<my-package2>
ERROR: invocation failed (exit code 2), logfile: /var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/log/python2.7-qa1-2.log
================================== log start ===================================
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://jenkins:****@libs.everbridge.net/artifactory/api/pypi/pypi-release-local/simple
Collecting <my-package1>
  Downloading https://libs.everbridge.net/artifactory/api/pypi/pypi-release-local/packages/<my-package1>/1.9.46.45/<my-package1>-1.9.46.45.tar.gz
Collecting <my-package2>
  Downloading https://libs.everbridge.net/artifactory/api/pypi/pypi-release-local/packages/<my-package2>/1.9.46.186/<my-package2>-1.9.46.186.tar.gz (5.3MB)
Building wheels for collected packages: <my-package1>, <my-package2>
  Building wheel for <my-package1> (setup.py): started
  Building wheel for <my-package1> (setup.py): finished with status 'done'
  Stored in directory: /var/lib/jenkins/.cache/pip/wheels/78/79/e5/dce304dd4c45a3a2c0ac3276287407ecfa49e5f743b61ac7fe
  Building wheel for <my-package2> (setup.py): started
  Building wheel for <my-package2> (setup.py): finished with status 'done'
  Stored in directory: /var/lib/jenkins/.cache/pip/wheels/79/6f/3d/96722fd79b17dca60dce264d3099b5c6fc1e02e20fed8aded2
ERROR: Exception:
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 178, in main
    status = self.run(options, args)
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 376, in run
    session=session,
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 67, in build_wheels
    session=session, autobuilding=True
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/wheel.py", line 1081, in build
    session=session,
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/download.py", line 873, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/download.py", line 807, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 628, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/var/lib/jenkins/workspace/QA/<my-job-name>/.tox/python2.7-qa1/local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 521, in unzip_file
    fp = zip.open(name)
  File "/usr/lib/python2.7/zipfile.py", line 968, in open
    raise BadZipfile("Truncated file header")
BadZipfile: Truncated file header

=================================== log end ====================================
ERROR: could not install deps [--no-cache-dir, -rrequirements.txt, :EB_SERVER:<my-package1>, :EB_SERVER:<my-package2>];

I already add --no-cache-dir in my tox.ini, why still has the issue?

[testenv:python2.7-qa2]
setenv =
    EB_ENV = qa2
passenv = PROC_LOG EB_LOG LOGIN_TYPE
deps =
    --no-cache-dir
    -rrequirements.txt
    :EB_SERVER:<my-package1>
    :EB_SERVER:<my-package2>
commands =
    <some commands>
uranusjr commented 5 years ago

I don’t believe you can pass pip arguments directly in deps; Tox’s documentation says it needs to be actual dependencies (or -r). You probably want to overwrite install_command instead.

Further discussion likely belongs to tox, not pip.

cindy-li-qa commented 5 years ago

Thank you so much