Pip: Infinite loop on pip when lockfile can't acquire a lock

Created on 2 Mar 2016  ยท  26Comments  ยท  Source: pypa/pip

  • Pip version: 8.0.3
  • Python version: 3.5.1
  • Operating System: Windows 10x64

    Description:

  • running pip list -o with Sphinx 1.3.6 (the current version) causes pip to go into some sort of infinite loop. Nothing is printed to the console.

  • trying to install Sphinx 1.3.6 from PyPI start an infinite loop and the package is never installed.
  • tyring to update Sphinx (pip install sphinx -U) starts an infinite loop and nothing seems to happen
  • Sphinx can be installed from a downloaded wheel (from PyPI) without issue.
  • other pip commands seem to work without issue.
  • the issue doesn't seem to be limited to Sphinx 1.3.6, but I can't seem to narrow that down any further

    What I've run:

broken pip sphinx

vendored dependency auto-locked bug

Most helpful comment

Deleting ~/.cache/pip resolved this issue for me. I had previously tried several different versions/venvs of python3.[4,5,6] and all blocked on mkdirlock.

The bug I think is rather that some earlier usage of pip leaves a lock-file in place? (pip exits uncleanly elsewhere?)

All 26 comments

@MinchinWeb Does adding --no-cache-dir to pip list -o --no-cache-dir avoid the issue ?

@xavfernandez , yes that seems to solve it. both pip list -o --no-cache-dir and pip install sphinx -U --no-cache-dir work

So this looks like a duplicate of #3245.

Could you investigate with a step-by-step debugger to check where pip is hanging ?

Running with verbose mode on (in a new virtualenv) provides the following:

> pip install sphinx -vvv

Collecting sphinx
  1 location(s) to search for versions of sphinx:
  * https://pypi.python.org/simple/sphinx/
  Getting page https://pypi.python.org/simple/sphinx/
  Looking up "https://pypi.python.org/simple/sphinx/" in the cache
  No cache entry available
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/sphinx/ HTTP/1.1" 200 5450
  Updating cache with response from "https://pypi.python.org/simple/sphinx/"
  Caching b/c date exists and max-age > 0

[ it stalls here, so I end it with CTRL+C ]

Cleaning up...

Operation cancelled by user

Exception information:
Traceback (most recent call last):
  File "c:\tmp\env\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 40, in acquire
    os.mkdir(self.lock_file)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'c:\\users\\william\\appdata\\local\\pip\\cache\\http\\6\\3\\c\\4\\2\\63c426d150091b9663b3d4923999b229a56ede976ab93677382d9562.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\tmp\env\lib\site-packages\pip\basecommand.py", line 209, in main
    status = self.run(options, args)
  File "c:\tmp\env\lib\site-packages\pip\commands\install.py", line 310, in run
    wb.build(autobuilding=True)
  File "c:\tmp\env\lib\site-packages\pip\wheel.py", line 747, in build
    self.requirement_set.prepare_files(self.finder)
  File "c:\tmp\env\lib\site-packages\pip\req\req_set.py", line 359, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\tmp\env\lib\site-packages\pip\req\req_set.py", line 511, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "c:\tmp\env\lib\site-packages\pip\req\req_install.py", line 277, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "c:\tmp\env\lib\site-packages\pip\index.py", line 436, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "c:\tmp\env\lib\site-packages\pip\index.py", line 394, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "c:\tmp\env\lib\site-packages\pip\index.py", line 539, in _get_pages
    page = self._get_page(location)
  File "c:\tmp\env\lib\site-packages\pip\index.py", line 642, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "c:\tmp\env\lib\site-packages\pip\index.py", line 751, in get_page
    "Cache-Control": "max-age=600",
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\sessions.py", line 480, in get
    return self.request('GET', url, **kwargs)
  File "c:\tmp\env\lib\site-packages\pip\download.py", line 377, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\sessions.py", line 608, in send
    r.content
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\models.py", line 737, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\models.py", line 660, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 344, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\tmp\env\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 301, in read
    data = self._fp.read(amt)
  File "c:\tmp\env\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
    self.__callback(self.__buf.getvalue())
  File "c:\tmp\env\lib\site-packages\pip\_vendor\cachecontrol\controller.py", line 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "c:\tmp\env\lib\site-packages\pip\download.py", line 280, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "c:\tmp\env\lib\site-packages\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "c:\tmp\env\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 197, in __enter__
    self.acquire()
  File "c:\tmp\env\lib\site-packages\pip\_vendor\lockfile\mkdirlockfile.py", line 57, in acquire
    time.sleep(wait)
KeyboardInterrupt

So if I read that right, it can't create the lock file because one already exists, so it's waiting for the lock folder to disappear (probably to try again). My guess is this is the infinite loop it's stuck in.

Deleting the lock folder in question doesn't seem to help running processes, but does allow a new process to install Sphinx.

Update: Turns out there was another rogue lock folder (f9daaa0b90d3f26ba99d3a4afed1be31abd9eddd0acd969de27db871.lock). Deleting that allows running processes to keep going and finish as expected.

Does there need to be a limit applied to how long it will wait? Should some procedure be put in place to clear out old lock folders? Or at least tell the user which lock folder is holding up pip? As a minimum, if you break out of the pip (without using the verbose options), it should tell you what lock folder it's hung up on.

@xavfernandez : Have I provided enough information to fix the issue?

Also seeing this infinite loop issue with pip v8.1.1 after installing any package.

I had the same issue so to bypass it I had to delete the cache .lock of pip as @MinchinWeb has said or I had to put a return after line 56 in mkdirlockfile.py to avoid the time.sleep function

Hi,
Sorry for interrupting
I had the similar issue with locking (not same but related) with both pip2 and pip3 on Arch Linux
pip --version [22:27:05] pip 8.1.2 from /usr/lib/python3.5/site-packages (python 3.5)
pip2 --version [22:27:11] pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

and the same solution as done by @Reston, fixes the issues. Before this every pip install got stuck after the successfully installed message
screenshot from 2016-07-25 22-29-49

I'm running into this issue as well and it basically boils down to mkdirlockfile getting stuck because the timeout is None.

You get stuck hitting the time.sleep() and while loop endlessly here:
https://github.com/openstack/pylockfile/blob/master/lockfile/mkdirlockfile.py#L57

This happens to me on OSX Sierra using python and pip installed via brew.

โฏ pip --version
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)

Perhaps the simplest is to add self.release() after time.sleep(wait) on line 58 of mkdirlockfile.py

Since this is still open, and I've had this issue multiple times, I'm adding info from my side (it's happened multiple times but it has sort of resolved itself after a while, don't actually know why).


$ pip --version
pip 9.0.1 from /home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages (python 3.5)

EDIT:


Traceback (most recent call last):
  File "/home/scorch/repo/alp/alp-teams/env/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/__init__.py", line 233, in main
    return command.main(cmd_args)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/basecommand.py", line 252, in main
    pip_version_check(session)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/utils/outdated.py", line 126, in pip_version_check
    headers={"Accept": "application/json"},
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py", line 628, in send
    r.content
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/models.py", line 755, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/models.py", line 676, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 314, in read
    data = self._fp.read(amt)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 63, in read
    self._close()
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 50, in _close
    self.__callback(self.__buf.getvalue())
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/cachecontrol/controller.py", line 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/download.py", line 289, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/lockfile/__init__.py", line 197, in __enter__
    self.acquire()
  File "/home/scorch/repo/alp/alp-teams/env/lib/python3.5/site-packages/pip/_vendor/lockfile/mkdirlockfile.py", line 57, in acquire
    time.sleep(wait)
KeyboardInterrupt

Deleting ~/.cache/pip resolved this issue for me. I had previously tried several different versions/venvs of python3.[4,5,6] and all blocked on mkdirlock.

The bug I think is rather that some earlier usage of pip leaves a lock-file in place? (pip exits uncleanly elsewhere?)

The approach @MinchinWeb used worked for me as well. Thanks for bringing this up!

Happened to me just now with 9.0.1 on Mac OS X.

Not sure where the lock file is though to remove it. :-( (Edit: Removing ~/Library/Caches/pip worked.)

I'm experiencing this problem. I'm using pip 9.0.1, Python 3.6.1, on Red Hat Enterprise Linux Server release 6.9 (Santiago). My home directory is on a panfs filesystem, which may or may not be relevant.

The output of a regular pip install --upgrade xarray is:

Requirement already up-to-date: xarray in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages
Requirement already up-to-date: numpy>=1.11 in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages (from xarray)
Requirement already up-to-date: pandas>=0.18.0 in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages (from xarray)
Requirement already up-to-date: python-dateutil>=2 in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages (from pandas>=0.18.0->xarray)
Requirement already up-to-date: pytz>=2011k in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages (from pandas>=0.18.0->xarray)

And then it hangs.

The final part of the output of pip install --upgrade xarray --verbose is:

Installed version (2017.3) is most up-to-date (past versions: 2011k, 2011n, 2012d, 2012f, 2012g, 2012h, 2012j, 2013d, 2012b0, 2012rc0, 2013b0, 2013.6, 2013.7, 2013.8, 2013.9, 2014.1, 2014.1.1, 2014.2, 2014.3, 2014.4, 2014.7, 2014.9, 2014.10, 2015.2, 2015.4, 2015.6, 2015.7, 2016.1, 2016.2, 2016.3, 2016.4, 2016.6, 2016.6.1, 2016.7, 2016.10, 2017.2, 2017.3)
Requirement already up-to-date: pytz>=2011k in /dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages (from pandas>=0.18.0->xarray)
1 location(s) to search for versions of six:
* https://pypi.python.org/simple/six/
Getting page https://pypi.python.org/simple/six/
Looking up "https://pypi.python.org/simple/six/" in the cache
No cache entry available
"GET /simple/six/ HTTP/1.1" 200 2699
Updating cache with response from "https://pypi.python.org/simple/six/"
Caching b/c date exists and max-age > 0

After I interrupt it, two tracebacks are shown:

^CCleaning up...
Operation cancelled by user
Exception information:
Traceback (most recent call last):
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/lockfile/mkdirlockfile.py", line 40, in acquire
    os.mkdir(self.lock_file)
FileExistsError: [Errno 17] File exists: '/home/users/gholl/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 487, in _prepare_file
    req_to_install, finder)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 428, in _check_skip_installed
    req_to_install, upgrade_allowed)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 628, in send
    r.content
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/models.py", line 755, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/models.py", line 676, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 314, in read
    data = self._fp.read(amt)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 63, in read
    self._close()
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 50, in _close
    self.__callback(self.__buf.getvalue())
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py", line 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/download.py", line 289, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/lockfile/__init__.py", line 197, in __enter__
    self.acquire()
  File "/dev/shm/gerrit/venv/stable-3.6/lib/python3.6/site-packages/pip/_vendor/lockfile/mkdirlockfile.py", line 57, in acquire
    time.sleep(wait)
KeyboardInterrupt 

I set a breakpoint at the line where it freezes. At this point:

  • timeout is None
  • self.lockfile == /home/users/gholl/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a.lock
  • err == FileExistsError(17, 'File exists')
  • self.unique_name == /home/users/gholl/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a.lock/host293.jc.rl.ac.uk.-8ba4570011129. This does does not exist. In fact, there are no files within the directory /home/users/gholl/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a.lock.

The cache directory is on a networked file system and may be shared between multiple hosts. It may be that pip running on either this or another machine got violently interrupted and failed to clean up after itself. Now it's stuck forever.

I can also confirm that deleting (or renaming) the directory /gholl/.cache/pip/http/b/9/2/d/5/b92d5efeb2406de109c0263ebfbbe56d85532219b7d0aae49a57069a.lock indeed solves the problem. I have renamed it, not deleted it, so I should be able to reproduce the problem in case developers desire any further diagnostics.

This seems to be a bug in the lockfile module which we vendor. We don't normally modify vendored libraries, rather asking for bugs to be reported to the vendored package's maintainers, and we'll pick up the fix when we re-vendor. However, in this case, lockfile has apparently been deprecated (from the PyPI page, "Note: This package is deprecated. It is highly preferred that instead of using this code base that instead fasteners or oslo.concurrency is used instead.").

Unfortunately, migrating to another library is a non-trivial exercise, and the two suggested options may be problematic - fasteners doesn't seem to have seen much recent activity, and oslo.concurrency seems much broader in scope.

@pypa/pip-committers what's the best option here? We do carry some patches to vendored code in the tasks directory. Should we accept bugfix patches to lockfile in that form? I'm concerned that if we do that, maintaining those fixes (and explaining to contributors how to prepare a patch) will be non-trivial.

@pfmoore There's #4766 for exactly that discussion.

Thanks @pradyunsg - I missed that issue when I was looking (annoying, as I did recall we'd raised the question previously).

You're welcome! ^>^

I remember thinking that all issues that mention lockfile should get linked to that, for completely connecting things and tying loose ends, but never actually got to it. I'll see if I get the time for that.

I am not sure if this is the same bug as the one I linked fro virtualenv but in my case an upgrade of httplib2 (py27) did help be avoid having to clean the cache (which is something that should never be needed).

sudo pip install --upgrade-strategy only-if-needed 'httplib2>=0.10.3'

I know for sure that the version I already had on the system (0.9.2) was buggy.

10 versions later, still bugged. Possibly unique bug.

C:\Users\Ryan>pip -V
pip 18.0 from c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)

C:\Users\Ryan>pip list
Package     Version
----------- -------
Click       7.0
mysqlclient 1.3.13
pip         18.0
pip-tools   3.0.0
setuptools  39.0.1
six         1.11.0
Traceback (most recent call last):
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\lockfile\linklockfile.py", line 31, in acquire
    os.link(self.unique_name, self.lock_file)
OSError: [WinError 50] The request is not supported: 'C:\\Users\\Ryan\\AppData\\Local\\pip\\Cache\\DESKTOP-7FGVKJ1-4058.19500-8774540993712083118' -> 'C:\\Users\\Ryan\\AppData\\Local\\pip\\Cache\\selfcheck.json.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ryan\AppData\Local\Programs\Python\Python37\Scripts\pip.exe\__main__.py", line 9, in <module>
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\__init__.py", line 310, in main
    return command.main(cmd_args)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\basecommand.py", line 183, in main
    pip_version_check(session, options)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\outdated.py", line 121, in pip_version_check
    state.save(pypi_version, current_time)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_internal\utils\outdated.py", line 44, in save
    with lockfile.LockFile(self.statefile_path):
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\lockfile\__init__.py", line 197, in __enter__
    self.acquire()
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\lockfile\linklockfile.py", line 50, in acquire
    time.sleep(timeout is not None and timeout / 10 or 0.1)
KeyboardInterrupt

here's a strace dump:

select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=94331}) = 0 (Timeout)
mkdir("/var/lib/jenkins/.cache/pip/http/6/b/9/8/f/6b98f776c5f9a73b8e68673f48320a329fa97d96868582b350b08cb3.lock", 0777) = -1 EEXIST (File exists)
stat("/var/lib/jenkins/.cache/pip/http/6/b/9/8/f/6b98f776c5f9a73b8e68673f48320a329fa97d96868582b350b08cb3.lock/sabit.-2e4514c019030", 0x7fff4c68d9b0) = -1 ENOENT (No such file or directory)
select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=100000}) = 0 (Timeout)
mkdir("/var/lib/jenkins/.cache/pip/http/6/b/9/8/f/6b98f776c5f9a73b8e68673f48320a329fa97d96868582b350b08cb3.lock", 0777) = -1 EEXIST (File exists)
stat("/var/lib/jenkins/.cache/pip/http/6/b/9/8/f/6b98f776c5f9a73b8e68673f48320a329fa97d96868582b350b08cb3.lock/sabit.-2e4514c019030", 0x7fff4c68d9b0) = -1 ENOENT (No such file or directory)
select(0, NULL, NULL, NULL, {tv_sec=0, tv_usec=100000}) = 0 (Timeout)
mkdir("/var/lib/jenkins/.cache/pip/http/6/b/9/8/f/6b98f776c5f9a73b8e68673f48320a329fa97d96868582b350b08cb3.lock", 0777) = -1 EEXIST (File exists)

etc etc

For folks who want to help resolve this issue, https://github.com/pypa/pip/issues/4766 is likely the best way to fix this.

We've fixed this via #4766.

It's a little bit amazing to see the winding, 3 year road from bug report to fix. Keep up the good work!

Was this page helpful?
0 / 5 - 0 ratings