question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip (sometimes) fails when multiple projects are installing the same binary in parallel

See original GitHub issue
Traceback (most recent call last):
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 228, in _main
    status = self.run(options, args)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/commands/download.py", line 134, in run
    reqs, check_supported_wheels=True
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
    self._populate_link(req)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
    req.link = self._find_requirement_link(req)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
    best_candidate = self.finder.find_requirement(req, upgrade)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/package_finder.py", line 899, in find_requirement
    req.name, specifier=req.specifier, hashes=hashes,
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/package_finder.py", line 826, in find_all_candidates
    project_url, link_evaluator=link_evaluator,
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/package_finder.py", line 790, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/collector.py", line 643, in fetch_page
    return _get_html_page(location, session=self.session)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/collector.py", line 455, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/index/collector.py", line 169, in _get_html_response
    "Cache-Control": "max-age=0",
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_internal/network/session.py", line 421, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/adapters.py", line 416, in send
    self.cert_verify(conn, request.url, verify, cert)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/adapters.py", line 224, in cert_verify
    cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/utils.py", line 255, in extract_zipped_paths
    extracted_path = zip_file.extract(member, path=tmp)
  File "/Users/runner/hostedtoolcache/PyPy/2.7.13/x64/lib-python/2.7/zipfile.py", line 1036, in extract
    return self._extract_member(member, path, pwd)
  File "/Users/runner/hostedtoolcache/PyPy/2.7.13/x64/lib-python/2.7/zipfile.py", line 1083, in _extract_member
    os.makedirs(upperdirs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/lib-python/2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip/_vendor/certifi'
 [ERROR via_app_data:111]
271280 downloaded wheel setuptools-44.1.1-py2.py3-none-any.whl [DEBUG acquire:69]

Is it possible that multiple pip instances share the same temp folder? (/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn). The error in question focused:

    cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/site-packages/virtualenv/seed/wheels/embed/pip-20.2.3-py2.py3-none-any.whl/pip/_vendor/requests/utils.py", line 255, in extract_zipped_paths
    extracted_path = zip_file.extract(member, path=tmp)
  File "/Users/runner/hostedtoolcache/PyPy/2.7.13/x64/lib-python/2.7/zipfile.py", line 1036, in extract
    return self._extract_member(member, path, pwd)
  File "/Users/runner/hostedtoolcache/PyPy/2.7.13/x64/lib-python/2.7/zipfile.py", line 1083, in _extract_member
    os.makedirs(upperdirs)
  File "/Users/runner/work/virtualenv/virtualenv/.tox/pypy/lib-python/2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip/_vendor/certifi'
 [ERROR via_app_data:111]
271280 downloaded wheel setuptools-44.1.1-py2.py3-none-any.whl [DEBUG acquire:69]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
pradyunsgcommented, Oct 7, 2022

I guess this has been resolved at some point in the ~2 years since this was filed? We’ve certainly got the requests version updated.

I’ll go ahead and close this, but feel welcome to holler here (or file a new issue, if this is locked) if this is still happening.

1reaction
gaborbernatcommented, Dec 25, 2020

I filled in https://github.com/psf/requests/pull/5707 to solve this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

concurrent pip-install fails to build wheel due to race #9034
When running pip in parallel (multiple processes) to install some source distribution, the wheel creation phase fails because all processes ...
Read more >
Parallel Pip install - python - Stack Overflow
Parallel pip installation. This example uses xargs to parallelize the build process by approximately 4x. You can increase the parallelization factor with ...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
The pip install <package> command always looks for the latest version of the package and installs it. It also searches for dependencies listed ......
Read more >
Python on the HPC Clusters - Princeton Research Computing
While pip installs will often download a binary wheel (pre-compiled), the user frequently needs to take action to satisfy the dependencies. Furthermore, many...
Read more >
Environments, Conda, Pip, aaaaah! | by Dennis Bakhuis
There are many ways to install Python and unfortunately, it is very easy to create a mess. In this blog post I describe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found